Prechádzať zdrojové kódy

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

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

Close #982
George Cushen 5 rokov pred
rodič
commit
dc0407a0e2

+ 3 - 0
exampleSite/config/_default/params.toml

@@ -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
layouts/partials/page_metadata_authors.html

@@ -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 -}}