taxonomy: warn on missing term title #709

This commit is contained in:
Sören Weber 2023-10-30 23:22:25 +01:00
parent 5a35a4a7ac
commit ec482bb3de
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
3 changed files with 9 additions and 2 deletions

View file

@ -2,9 +2,12 @@
title = "a secret"
+++
This lists all pages that are hidden from the home page. This includes pages that define `hidden=true` in their frontmatter as weill as descendents of hidden pages.
This lists all pages that are hidden from the home page. This includes pages that define `hidden=true` in their frontmatter as well as descendents of hidden pages.
When giving term pages, you should give it a title. Otherwise it will print out a warning and will use the urlized title, which may looks weird.
While internally this term is called `hidden`, it is referenced in the resulting english pages as `a secret` and as `hush, matey` in the piratish translation.
This tag also has a title. While internally it is called `hidden`, it is referenced in the resulting pages as `a secret`.
## Just an example heading

View file

@ -1,3 +1,4 @@
+++
title = "hush, matey"
+++
{{< piratify >}}

View file

@ -14,6 +14,9 @@
{{- $terms := slice }}
{{- range .Data.Terms }}
{{- $terms = $terms | append (dict "Title" (default .Page.Data.Term .Page.Title) "Term" . )}}
{{- if not .Page.Title }}
{{- warnf "%q: You have not given a 'title' in the frontmatter of your term page, the urlized title will be used instead" .Page.File.Filename }}
{{- end }}
{{- end }}
{{- range sort $terms ".Title" }}
{{- $capital := substr .Title 0 1 | upper }}