Tweak to taxonomy partials to reduce code duplication and add single point of change (#165)
2 files modified
1 files added
| | |
| | | <span class="separator"> |
| | | {{- range $index, $el := . -}} |
| | | {{- $category := replace . "#" "%23" -}} |
| | | {{- $category = replace $category "." "%2e" -}} |
| | | <a class="category" href="{{ ( printf "categories/%s/" ( $category | urlize ) ) | relLangURL }}">{{ . }}</a> |
| | | {{- end -}} |
| | | </span> |
| | | {{ partial "taxonomy/template.html" (dict "items" . "linkClass" "category" "linkBase" "categories") }} |
| | |
| | | <span class="separator"> |
| | | {{- range $index, $el := . -}} |
| | | {{- $tag := replace . "#" "%23" -}} |
| | | {{- $tag = replace $tag "." "%2e" -}} |
| | | <a class="tag" href="{{ ( printf "tags/%s/" ( $tag | urlize ) ) | relLangURL }}">{{- . -}}</a> |
| | | {{- end -}} |
| | | </span> |
| | | {{ partial "taxonomy/template.html" (dict "items" . "linkClass" "tag" "linkBase" "tags") }} |
| New file |
| | |
| | | {{- $linkClass := .linkClass -}} |
| | | {{- $linkBase := .linkBase -}} |
| | | |
| | | <span class="separator"> |
| | | {{- range $index, $el := .items -}} |
| | | <!-- Replace certain special characters with their URL encoded counterparts --> |
| | | {{- $item := replace . "#" "%23" -}} |
| | | {{- $item = replace $item "." "%2e" -}} |
| | | {{- $link := ( printf "%s/%s/" $linkBase ( $item | urlize ) ) | relLangURL -}} |
| | | <a class="{{$linkClass}}" href="{{$link}}">{{- . -}}</a> |
| | | {{- end -}} |
| | | </span> |