1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-11-14 16:27:04 +01:00
hugo-theme-bootstrap4-blog/layouts/partials/meta-terms.html
Alan Orth d4ece493ba
layouts/partials/meta-terms.html: Trailing slash
Hard code a trailing slash in URLs for categories and tags to avoid
an HTTP 301 redirect at the very least, and an HTTP 404 at the very
worst (depending on web server configuration).

This is a workaround for a problem caused by our manual construction
of URLs using the categories and tags strings in post front matter.
Hugo's own taxonomy tooling always uses a trailing slash.

See: https://github.com/alanorth/hugo-theme-bootstrap4-blog/issues/128
2020-01-28 10:50:31 +02:00

9 lines
597 B
HTML

{{ if .Params.categories }}
<span class="fas fa-folder" aria-hidden="true"></span>&nbsp;{{ range $index, $category := .Params.categories }}{{ if gt $index 0 }}{{ i18n "comma" }} {{ end }}<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}/" rel="category tag">{{ . }}</a>{{ end }}
{{ end }}
{{ if .Params.tags }}
<span class="fas fa-tag" aria-hidden="true"></span>&nbsp;{{ range $index, $tag := .Params.tags }}{{ if gt $index 0 }}{{ i18n "comma" }} {{ end }}<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}/" rel="tag">{{ . }}</a>{{ end }}
{{ end }}
{{- /* vim: set ts=2 sw=2 et: */}}