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> <!DOCTYPE html>
{{ $social := slice "twitter" "github" "instagram" }}<!----> {{ $social := slice "twitter" "github" "instagram" }}<!---->
{{ range $key, $val := site.Params }}<!----> {{ range $social }}<!---->
{{ if in $social $key }}<!----> {{ if isset site.Params . }}<!---->
{{ $.Scratch.SetInMap "social-map" $key $val }}<!----> {{ $.Scratch.Add "social-list" (slice .) }}<!---->
{{ end }}<!----> {{ end }}<!---->
{{ end }}<!----> {{ end }}<!---->

View file

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

View file

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