From d823d5cd5f194e842edb87c3e0433486312b6f13 Mon Sep 17 00:00:00 2001 From: nanxiaobei Date: Tue, 24 Aug 2021 10:56:07 +0800 Subject: [PATCH] fix social order --- layouts/_default/baseof.html | 6 +++--- layouts/partials/head.html | 4 ++-- layouts/partials/header.html | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 8d6802f..889dfcb 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,9 +1,9 @@ {{ $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 }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 91cad2c..75e1335 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -35,8 +35,8 @@ - {{ range $key, $val := $.Scratch.Get "social-map" }} - + {{ range $.Scratch.Get "social-list" }} + {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a67de26..be6b724 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -45,13 +45,13 @@ {{ end }} - {{ with $.Scratch.Get "social-map" }} + {{ with $.Scratch.Get "social-list" }}