diff options
author | Derek Severin <severinderek@gmail.com> | 2018-10-15 13:43:45 +0300 |
---|---|---|
committer | Derek Severin <severinderek@gmail.com> | 2018-10-15 13:43:45 +0300 |
commit | 3ad003f159804820cc8fb9d98d44fc972bd5f6eb (patch) | |
tree | 52c390e6aba8c0aeaaa8643462eab4e74e1a7de5 | |
parent | e9f1a50f918e6054087cef3c3346ea2fb2a990bc (diff) |
SKILLS: duplicate tags and categories fix
-rw-r--r-- | layouts/partials/sections/skills.html | 16 | ||||
-rw-r--r-- | layouts/partials/utils/list-keywords-range.html | 24 |
2 files changed, 28 insertions, 12 deletions
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" }} <h4>{{ $label }}</h4> <div class="tags"> - {{ 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 }} </div> </div> </div> @@ -55,12 +51,8 @@ {{ $label := or $data.categories_label "CATEGORIES" }} <h4>{{ $label }}</h4> <div class="tags"> - {{ 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 }} </div> </div> </div> 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) }} + <a href="{{ (print "/" $.type "/") | relLangURL }}{{ . | urlize }}" title="{{ . }}"> + {{ . }} + </a> +{{ end }} +{{ .scratch.Delete .type }} |