From 3ad003f159804820cc8fb9d98d44fc972bd5f6eb Mon Sep 17 00:00:00 2001 From: Derek Severin Date: Mon, 15 Oct 2018 17:43:45 +0700 Subject: SKILLS: duplicate tags and categories fix --- layouts/partials/sections/skills.html | 16 ++++------------ layouts/partials/utils/list-keywords-range.html | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 layouts/partials/utils/list-keywords-range.html diff --git a/layouts/partials/sections/skills.html b/layouts/partials/sections/skills.html index 0770d11..a177cbf 100644 --- a/layouts/partials/sections/skills.html +++ b/layouts/partials/sections/skills.html @@ -40,12 +40,8 @@ {{ $label := or $data.tags_label "TAGS" }}

{{ $label }}

- {{ range $project_sections }} - {{ with $.Site.GetPage "section" . }} - {{ $params := (dict "type" "tags" "context" . "scratch" .Scratch "removeDuplicates" true) }} - {{ partial "utils/list-keywords.html" $params }} - {{ end }} - {{ end }} + {{ $params := (dict "type" "tags" "context" $project_sections "site" $.Site "scratch" .Scratch "removeDuplicates" true) }} + {{ partial "utils/list-keywords-range.html" $params }}
@@ -55,12 +51,8 @@ {{ $label := or $data.categories_label "CATEGORIES" }}

{{ $label }}

- {{ range $project_sections }} - {{ with $.Site.GetPage "section" . }} - {{ $params := (dict "type" "categories" "context" . "scratch" .Scratch "removeDuplicates" true) }} - {{ partial "utils/list-keywords.html" $params }} - {{ end }} - {{ end }} + {{ $params := (dict "type" "categories" "context" $project_sections "site" $.Site "scratch" .Scratch "removeDuplicates" true) }} + {{ partial "utils/list-keywords-range.html" $params }}
diff --git a/layouts/partials/utils/list-keywords-range.html b/layouts/partials/utils/list-keywords-range.html new file mode 100644 index 0000000..2ecd4d8 --- /dev/null +++ b/layouts/partials/utils/list-keywords-range.html @@ -0,0 +1,24 @@ +{{/* + Parameters: + - type: "tags" or "categories" + - context: (project_sections) + - site: (Site) + - scratch: (Scratch) + - removeDuplicates: BOOL +*/}} + +{{ .scratch.Delete .type }} +{{ range .context }} + {{ with $.site.GetPage "section" . }} + {{ $params := (dict "type" $.type "context" . "scratch" $.scratch "removeDuplicates" $.removeDuplicates) }} + {{ partial "utils/get-keywords.html" $params }} + {{ end }} +{{ end }} +{{ .scratch.Set .type (uniq (.scratch.Get .type)) }} + +{{ range (.scratch.Get .type) }} + + {{ . }} + +{{ end }} +{{ .scratch.Delete .type }} -- cgit v1.2.3