1
0
Fork 0

fix social order

This commit is contained in:
nanxiaobei 2021-08-24 10:56:07 +08:00
parent bc5b6b4e94
commit d823d5cd5f
3 changed files with 10 additions and 10 deletions

View file

@ -1,9 +1,9 @@
<!DOCTYPE html>
{{ $social := slice "twitter" "github" "instagram" }}<!---->
{{ range $key, $val := site.Params }}<!---->
{{ if in $social $key }}<!---->
{{ $.Scratch.SetInMap "social-map" $key $val }}<!---->
{{ range $social }}<!---->
{{ if isset site.Params . }}<!---->
{{ $.Scratch.Add "social-list" (slice .) }}<!---->
{{ end }}<!---->
{{ end }}<!---->

View file

@ -35,8 +35,8 @@
<!-- Preload -->
<link rel="preload" as="image" href="{{ `theme.png` | absURL }}" />
{{ range $key, $val := $.Scratch.Get "social-map" }}
<link rel="preload" as="image" href="{{ printf `%s.svg` $key | absURL }}" />
{{ range $.Scratch.Get "social-list" }}
<link rel="preload" as="image" href="{{ printf `%s.svg` . | absURL }}" />
{{ end }}
<!-- Favicon -->

View file

@ -45,13 +45,13 @@
</nav>
{{ end }}<!---->
{{ with $.Scratch.Get "social-map" }}
{{ with $.Scratch.Get "social-list" }}
<nav class="social">
{{ range $key, $val := . }}
{{ range . }}
<a
class="{{ $key }}"
style="--url: url(./{{ printf `%s.svg` $key }})"
href="https://{{ $key }}.com/{{ $val }}"
class="{{ . }}"
style="--url: url(./{{ . }}.svg)"
href="https://{{ . }}.com/{{ site.Params.Get . }}"
target="_blank"
></a>
{{ end }}