Convert authors to taxonomies
This commit is contained in:
30
README.md
30
README.md
@@ -304,30 +304,11 @@ The assigned values shown are the default values.
|
|||||||
|
|
||||||
The parameter object is accessed in site parameters as `[params.paige]`, and in page parameters as `[paige]`.
|
The parameter object is accessed in site parameters as `[params.paige]`, and in page parameters as `[paige]`.
|
||||||
|
|
||||||
Optional site parameters:
|
Parameters specific to pages:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[authors.will-faught]
|
|
||||||
default = false # Credit this author in pages that have no authors parameter
|
|
||||||
email = "will.faught@example.com"
|
|
||||||
name = "Will Faught"
|
|
||||||
url = "https://willfaught.com/paige"
|
|
||||||
```
|
|
||||||
|
|
||||||
Optional page parameters:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
authors = ["will-faught"] # Credit the corresponding author in the site parameters
|
|
||||||
link = "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title
|
link = "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title
|
||||||
|
|
||||||
[[authors]]
|
|
||||||
author = "will-faught" # Credit the corresponding author in the site parameters
|
|
||||||
|
|
||||||
[[authors]] # Credit this author
|
|
||||||
email = "will.faught@example.com"
|
|
||||||
name = "Will Faught"
|
|
||||||
url = "https://willfaught.com/paige"
|
|
||||||
|
|
||||||
[paige]
|
[paige]
|
||||||
alert = "Alert!" # Markdown displayed before the page body (defaults to primary alert type)
|
alert = "Alert!" # Markdown displayed before the page body (defaults to primary alert type)
|
||||||
pin = true # Display this page before the rest
|
pin = true # Display this page before the rest
|
||||||
@@ -404,6 +385,15 @@ weight = 40
|
|||||||
If you intend for the menu to be sufficient for all navigation,
|
If you intend for the menu to be sufficient for all navigation,
|
||||||
see [how to hide other navigation features](#menu-navigation-only).
|
see [how to hide other navigation features](#menu-navigation-only).
|
||||||
|
|
||||||
|
### Taxonomies
|
||||||
|
|
||||||
|
Support for authors, categories, series, and tags taxonomies is built in.
|
||||||
|
|
||||||
|
Set `default` to `true` in the front matter of an author term page for that author to be credited in regular pages that have no authors parameter.
|
||||||
|
A default author must be referenced at least once explicitly in a regular page.
|
||||||
|
|
||||||
|
The `email` and `url` parameters in the front matter of an author term page are used in feeds if present.
|
||||||
|
|
||||||
## Layouts
|
## Layouts
|
||||||
|
|
||||||
### Cloud
|
### Cloud
|
||||||
|
@@ -90,12 +90,6 @@ section = ["atom", "html", "rss"]
|
|||||||
taxonomy = ["atom", "html", "rss"]
|
taxonomy = ["atom", "html", "rss"]
|
||||||
term = ["atom", "html", "rss"]
|
term = ["atom", "html", "rss"]
|
||||||
|
|
||||||
[params.authors.will-faught]
|
|
||||||
default = true
|
|
||||||
email = "will.faught@example.com"
|
|
||||||
name = "Will Faught"
|
|
||||||
url = "https://willfaught.com/paige"
|
|
||||||
|
|
||||||
[params.paige]
|
[params.paige]
|
||||||
site_title = "Paige"
|
site_title = "Paige"
|
||||||
site_description = "Powerful, pliable pixel perfection"
|
site_description = "Powerful, pliable pixel perfection"
|
||||||
|
@@ -164,15 +164,15 @@
|
|||||||
{{ with partial "paige/authors.html" . }}
|
{{ with partial "paige/authors.html" . }}
|
||||||
{{ range . }}
|
{{ range . }}
|
||||||
<author>
|
<author>
|
||||||
{{ with .email }}
|
{{ with .Params.email }}
|
||||||
<email>{{ . }}</email>
|
<email>{{ . }}</email>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .name }}
|
{{ with .Params.Title }}
|
||||||
<name>{{ . }}</name>
|
<name>{{ . }}</name>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .url }}
|
{{ with .Params.url }}
|
||||||
<uri>{{ . }}</uri>
|
<uri>{{ . }}</uri>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</author>
|
</author>
|
||||||
|
@@ -85,10 +85,10 @@
|
|||||||
{{ with $authors }}
|
{{ with $authors }}
|
||||||
{{ $primary := index . 0 }}
|
{{ $primary := index . 0 }}
|
||||||
|
|
||||||
{{ if and $primary.name $primary.email }}
|
{{ if and $primary.Params.email $primary.Title }}
|
||||||
{{ $author = printf "%s (%s)" $primary.email $primary.name }}
|
{{ $author = printf "%s (%s)" $primary.Params.email $primary.Title }}
|
||||||
{{ else if $primary.email }}
|
{{ else if $primary.Params.email }}
|
||||||
{{ $author = $primary.email }}
|
{{ $author = $primary.Params.email }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@@ -1,40 +1,11 @@
|
|||||||
{{ $page := . }}
|
{{ $page := . }}
|
||||||
|
|
||||||
{{ $result := slice }}
|
{{ $result := $page.GetTerms "authors" }}
|
||||||
|
|
||||||
{{ if $page.Params.authors }}
|
{{ if and $page.IsPage (not $result) site.Taxonomies.authors }}
|
||||||
{{ range $page.Params.authors }}
|
{{ range $id, $taxonomy := site.Taxonomies.authors }}
|
||||||
{{ $email := "" }}
|
{{ if eq $taxonomy.Page.Params.default true }}
|
||||||
{{ $id := "" }}
|
{{ $result = $result | append $taxonomy.Page }}
|
||||||
{{ $name := "" }}
|
|
||||||
{{ $url := "" }}
|
|
||||||
|
|
||||||
{{ if reflect.IsMap . }}
|
|
||||||
{{ with .author }}
|
|
||||||
{{ $id = . }}
|
|
||||||
{{ $author := index site.Params.authors $id }}
|
|
||||||
{{ $email = $author.email }}
|
|
||||||
{{ $name = $author.name }}
|
|
||||||
{{ $url = $author.url }}
|
|
||||||
{{ else }}
|
|
||||||
{{ $email = .email }}
|
|
||||||
{{ $name = .name }}
|
|
||||||
{{ $url = .url }}
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ $id = . }}
|
|
||||||
{{ $author := index site.Params.authors $id }}
|
|
||||||
{{ $email = $author.email }}
|
|
||||||
{{ $name = $author.name }}
|
|
||||||
{{ $url = $author.url }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ $result = $result | append (dict "email" $email "id" $id "name" $name "url" $url) }}
|
|
||||||
{{ end }}
|
|
||||||
{{ else if site.Params.authors }}
|
|
||||||
{{ range $k, $v := site.Params.authors }}
|
|
||||||
{{ if eq $v.default true }}
|
|
||||||
{{ $result = $result | append (dict "email" $v.email "id" $k "name" $v.name "url" $v.url) }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@@ -52,15 +52,7 @@
|
|||||||
{{ range $i, $author := . -}}
|
{{ range $i, $author := . -}}
|
||||||
{{- if gt $i 0 }}, {{ end -}}
|
{{- if gt $i 0 }}, {{ end -}}
|
||||||
|
|
||||||
{{- with $author.id -}}
|
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||||
{{- with site.GetPage (print "authors/" .) -}}
|
|
||||||
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title | default $author.name }}</a>
|
|
||||||
{{- else -}}
|
|
||||||
{{- $author.name -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{- $author.name -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</p>
|
</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
{{ $authors := slice }}
|
{{ $authors := slice }}
|
||||||
|
|
||||||
{{ range . }}
|
{{ range . }}
|
||||||
{{ $authors = $authors | append .name }}
|
{{ $authors = $authors | append .Title }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<meta content="{{ delimit $authors `, ` }}" name="author">
|
<meta content="{{ delimit $authors `, ` }}" name="author">
|
||||||
|
@@ -84,15 +84,7 @@
|
|||||||
{{ range $i, $author := . -}}
|
{{ range $i, $author := . -}}
|
||||||
{{- if gt $i 0 }}, {{ end -}}
|
{{- if gt $i 0 }}, {{ end -}}
|
||||||
|
|
||||||
{{- with $author.id -}}
|
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||||
{{- with site.GetPage (print "authors/" .) -}}
|
|
||||||
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title | default $author.name }}</a>
|
|
||||||
{{- else -}}
|
|
||||||
{{- $author.name -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{- $author.name -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</p>
|
</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Reference in New Issue
Block a user