diff options
author | Oscar Najera <hi@oscarnajera.com> | 2024-12-27 04:01:34 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2024-12-27 21:59:22 +0100 |
commit | edf690072e871a3e6acd84b8e9fb84483fdebdc2 (patch) | |
tree | e843cc36fe2c0dbb9b47c3e416a7f1dd9ab8981c | |
parent | a77f5ec0e165c4e061f42b789bcddae75d6fe78c (diff) | |
download | hugo-minimalist-theme-edf690072e871a3e6acd84b8e9fb84483fdebdc2.tar.gz hugo-minimalist-theme-edf690072e871a3e6acd84b8e9fb84483fdebdc2.tar.bz2 hugo-minimalist-theme-edf690072e871a3e6acd84b8e9fb84483fdebdc2.zip |
Track author taxonomy
-rw-r--r-- | layouts/_default/author.html | 26 | ||||
-rw-r--r-- | layouts/partials/hero.html | 18 | ||||
-rw-r--r-- | layouts/partials/metadata.html | 16 | ||||
-rw-r--r-- | readme.org | 12 |
4 files changed, 57 insertions, 15 deletions
diff --git a/layouts/_default/author.html b/layouts/_default/author.html new file mode 100644 index 0000000..1179500 --- /dev/null +++ b/layouts/_default/author.html @@ -0,0 +1,26 @@ +{{ define "hero" }} + {{ partial "hero.html" . }} +{{ end }} +{{ define "main" }} + {{- $sectionDelimiter := "<!-- section break -->" -}} + {{- $rawContentSections := split .RawContent $sectionDelimiter -}} + {{ range $rawContentSections }} + <div class="stripe-dark"> + <div class="mw7 center pv2 lh-copy f4-ns ph1"> + {{ . | markdownify }} + </div> + </div> + {{ end }} + + + <div class="stripe-dark"> + <div class="mw7 center pv2 lh-copy f4-ns ph1"> + {{ range .Pages.GroupBy "Section" "asc" }} + <h2>{{ .Key }} {{ . }}</h2> + {{ range .Pages }} + {{ partial "post.html" . }} + {{ end }} + {{ end }} + </div> + </div> +{{ end }} diff --git a/layouts/partials/hero.html b/layouts/partials/hero.html index 3008ef2..1654b5d 100644 --- a/layouts/partials/hero.html +++ b/layouts/partials/hero.html @@ -6,7 +6,7 @@ {{ end }};" > <div class="mw7 center ph2 near-white lh-copy"> - {{ if eq .Type "about" }} + {{ if eq .Type "authors" }} {{ $avatar := index .Params.images 1 }} {{ if hasPrefix $avatar "http" }} {{ $avatar = resources.GetRemote $avatar }} @@ -17,14 +17,12 @@ <img src="{{ .RelPermalink }}" class="br-100 w5 db center" alt="" /> {{ end }} <h1 class="f1 tc mv1"> - {{ .Title }} + {{ .Params.Name }} </h1> - {{ if .Params.personal }} - <h2 class="f3 tc fw3 mv1"> - {{ .Site.Params.Author.role | markdownify }} - </h2> - {{ end }} + <h2 class="f3 tc fw3 mv1"> + {{ .Params.role | markdownify }} + </h2> {{ with .Params.Subtitle }} <h2 class="f3 tc fw3 mv1"> @@ -34,11 +32,7 @@ <div class="f2 mt3 tc"> - {{ if .Params.personal }} - {{ partial "social_links" .Site.Params.Author }} - {{ else }} - {{ partial "social_links" .Site.Params }} - {{ end }} + {{ partial "social_links" .Params }} </div> {{ else }} diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html index b2136bc..28dc5b4 100644 --- a/layouts/partials/metadata.html +++ b/layouts/partials/metadata.html @@ -1,9 +1,19 @@ {{ $dateTime := .PublishDate.Format "2006-01-02" }} {{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }} <div class="f6 lh-copy mv0 ph4 pv2"> - By - {{ with .Params.author }} - <span class="author"> — {{ delimit . ", " }} </span> + By — + {{ range .Params.authors }} + {{ $name := . }} + {{ $path := printf "/%s/%s" "authors" ( $name | urlize ) }} + {{ with $.GetPage $path }} + {{ if isset .Params "name" }} + <a class="link underline color-inherit" href="{{ .RelPermalink }}"> + {{- default $name .Params.name -}} + </a> + {{ else }} + {{ $name }} + {{ end }} + {{ end }} {{ end }} @@ -4,3 +4,15 @@ For that run the local makefile for the =css= target. It is only a dev dependency, there is no need for tachyons dependencies on the project. +* Design decisions +** Authors +=ox-hugo= exports from the =author= front matter regardless of it allowing +multiple items. It seems to prefer that and hints in this page, how to use the +plural. + +https://ox-hugo.scripter.co/doc/replace-front-matter-keys/#replace-author-with-authors + +I however find the plural =authors= consistent to the field accepting a list. +Secondly, it plays correctly with taxonomies which activate with the +singular=plural key=value. Thus be consistent on that and use the ox-hugo +replacing workaround. |