feat: add option to disable linking authors to their profile page

`link_authors` option added to `params.toml`.

Close #982
This commit is contained in:
George Cushen committed 2019-09-24 22:25:16 +01:00
1 parent 47427cc527
commit dc0407a0e2
2 files changed
+5 -1

No files matched your search

+3
View File
@@ -160,6 +160,9 @@ docs_section_pager = true # Display pager in Docs layout (e.g. tutorials)?
# Enable in-built social sharing buttons? (true/false)
sharing = true
# Link authors to their profile page? (true/false)
link_authors = true
# Load CSS and JS plugins
# E.g. To load `/assets/css/custom.css`, set `plugins_css = ["custom"]`.
# E.g. To load `/assets/js/custom.js`, set `plugins_js = ["custom"]`.
+2 -1
View File
@@ -2,13 +2,14 @@
{{ $taxonomy := "authors" }}
{{ with .Param $taxonomy }}
{{ $link_authors := site.Params.link_authors | default true }}
{{ range $index, $value := . }}
{{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy (. | urlize)) -}}
{{- $name := $profile_page.Params.name | default ($value|markdownify) -}}
{{- if gt $index 0 }}, {{ end -}}
<span>
{{- with $profile_page -}}
<a href="{{.RelPermalink}}">{{$name}}</a>
{{ if $link_authors }}<a href="{{.RelPermalink}}">{{$name}}</a>{{else}}{{$name}}{{end}}
{{- else -}}
{{$name}}
{{- end -}}