Переглянути джерело

feat: improvements to author list

- Re-refactor code to use Hugo's `GetTerms` function now that Hugo fixed the unordered bug
  - GetTerms may provide better support for names with unicode or spaces
- Use Bootstrap's bundled PopoverJS for *instant* and more legible author note tooltips.
- Make author notes more intuitive and mobile friendly - use FA icon with left padding to discern touches.
- Add support for highlighting multiple author names (e.g. team members)

BREAKING CHANGE:

To highlight an author name, add `highlight_name: true` to the author's profile.

Close #1750
Fix #1861
Close #1864
George Cushen 4 роки тому
батько
коміт
eb15a07dc3
1 змінених файлів з 6 додано та 5 видалено
  1. 6 5
      wowchemy/layouts/partials/page_metadata_authors.html

+ 6 - 5
wowchemy/layouts/partials/page_metadata_authors.html

@@ -1,17 +1,18 @@
 {{/* Display author list. */}}
 {{/* Display author list. */}}
 
 
 {{- $taxonomy := "authors" }}
 {{- $taxonomy := "authors" }}
-{{ with .Param $taxonomy }}
+{{ if .Param $taxonomy }}
   {{ $link_authors := site.Params.link_authors | default true }}
   {{ $link_authors := site.Params.link_authors | default true }}
-  {{ range $index, $name_raw := . }}
-    {{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy .) -}}
-    {{- $name := $profile_page.Title | default $name_raw -}}
+  {{ range $index, $value := (.GetTerms $taxonomy) }}
+    {{- /* Highlight the author's name? */ -}}
+    {{- $highlight_name := .Page.Params.highlight_name | default false -}}
+
     {{- if gt $index 0 }}, {{ end -}}
     {{- if gt $index 0 }}, {{ end -}}
     <span {{ if $highlight_name }}class="author-highlighted"{{end}}>
     <span {{ if $highlight_name }}class="author-highlighted"{{end}}>
       {{- if $link_authors -}}
       {{- if $link_authors -}}
         <a href="{{.RelPermalink}}">{{.LinkTitle}}</a>
         <a href="{{.RelPermalink}}">{{.LinkTitle}}</a>
       {{- else -}}
       {{- else -}}
-        {{$name}}
+        {{ .LinkTitle }}
       {{- end -}}
       {{- end -}}
     </span>
     </span>
     {{- if isset $.Params "author_notes" -}}
     {{- if isset $.Params "author_notes" -}}