layouts: let hugo generate URLs to taxonomy terms

This commit is contained in:
James Henstridge 2022-08-22 17:00:11 +08:00
parent 3eedfa1f8d
commit 1c9e1eb694
2 changed files with 7 additions and 7 deletions

View File

@ -7,13 +7,13 @@
</article> </article>
<div class="mw8 center"> <div class="mw8 center">
<section class="ph4"> <section class="ph4">
{{ range $key, $value := .Data.Terms }} {{ range $term := .Data.Pages }}
<h2 class="f1"> <h2 class="f1">
<a href="{{ "/" | relLangURL }}{{ $.Data.Plural | urlize }}/{{ $key | urlize }}" class="link blue hover-black"> <a href="{{ $term.RelPermalink }}" class="link blue hover-black">
{{ $.Data.Singular | humanize }}: {{ $key }} {{ $.Data.Singular | humanize }}: {{ $term.LinkTitle }}
</a> </a>
</h2> </h2>
{{ range $value.Pages }} {{ range $term.Pages }}
{{ .Render "summary" }} {{ .Render "summary" }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -1,8 +1,8 @@
<ul class="pa0"> <ul class="pa0">
{{ range .Params.tags }} {{ range .GetTerms "tags" }}
<li class="list di"> <li class="list di">
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif"> <a href="{{ .RelPermalink }}" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">
{{- . -}} {{- .LinkTitle -}}
</a> </a>
</li> </li>
{{ end }} {{ end }}