diff options
author | Franck Cuny <franck@fcuny.net> | 2021-04-06 12:33:39 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2021-04-11 11:51:39 -0700 |
commit | 81f002c3615784ff38fc957c14b993f08fb134fe (patch) | |
tree | 2dc8a474104cd84dda921a4a5338d200fcdb8f29 /users/fcuny/notes/layouts | |
parent | layout: add date and tags to single pages (diff) | |
download | world-81f002c3615784ff38fc957c14b993f08fb134fe.tar.gz |
taxonomy: add pages for tags
We want to have pages that list all the articles related to a given tag. Update the configuration to add support for tags and the permalink structure.
Diffstat (limited to 'users/fcuny/notes/layouts')
-rw-r--r-- | users/fcuny/notes/layouts/partials/postlist.html | 30 | ||||
-rw-r--r-- | users/fcuny/notes/layouts/taxonomy/tag.html | 6 |
2 files changed, 36 insertions, 0 deletions
diff --git a/users/fcuny/notes/layouts/partials/postlist.html b/users/fcuny/notes/layouts/partials/postlist.html new file mode 100644 index 0000000..3695d82 --- /dev/null +++ b/users/fcuny/notes/layouts/partials/postlist.html @@ -0,0 +1,30 @@ +<p><a href="/">← Back to Franck's homepage</a></p> + +{{ range .GroupByDate "2006-Jan" }} + <h2>{{ .Key }}</h2> + <ul> + {{ range .Pages.ByDate }} + <li> + <div> + <a href="{{ .Permalink }}"><h3>{{ .Title }}</h3></a> + {{ if .Params.tags }} + <div> + Tags: + {{ range $idx, $tag := .Params.tags }} + <span class="tags"><a href="/tags/{{ $tag | urlize }}/">{{ $tag }}</a></span> + {{ end }} + </div> + {{ else }} + <div></div> + {{ end }} + </div> + <div> + <p> + {{ .Summary }} + <span><a href="{{ .Permalink }}">Read more →</a></span> + </p> + </div> + </li> + {{ end }} + </ul> +{{ end }} diff --git a/users/fcuny/notes/layouts/taxonomy/tag.html b/users/fcuny/notes/layouts/taxonomy/tag.html new file mode 100644 index 0000000..2b7d98a --- /dev/null +++ b/users/fcuny/notes/layouts/taxonomy/tag.html @@ -0,0 +1,6 @@ +{{ define "main" }} + + {{ $pgs := where .Data.Pages "Params.hidden" "ne" "true" }} + {{ partial "postlist" $pgs }} + +{{ end }} |