refactor: replace site.Params.link_authors with Hugo's new _build capability

Hugo now directly supports page build options, so can remove workaround.
This commit is contained in:
George Cushen 2020-12-13 16:00:15 +00:00
commit a03ad69ff6
3 changed files with 6 additions and 6 deletions

View file

@ -14,14 +14,14 @@
{{ $avatar_shape := site.Params.avatar.shape | default "circle" }}
<div class="media author-card content-widget-hr">
{{ if and site.Params.avatar.gravatar $author_page.Params.email }}
<a href="{{$profile_url}}"><img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="https://s.gravatar.com/avatar/{{ md5 $author_page.Params.email }}?s=200')" alt="{{$author_page.Title}}"></a>
{{if $profile_url}}<a href="{{$profile_url}}">{{end}}<img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="https://s.gravatar.com/avatar/{{ md5 $author_page.Params.email }}?s=200" alt="{{$author_page.Title}}">{{if $profile_url}}</a>{{end}}
{{ else if $avatar }}
{{ $avatar_image := $avatar.Fill "270x270 Center" }}
<a href="{{$profile_url}}"><img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{$author_page.Title}}"></a>
{{if $profile_url}}<a href="{{$profile_url}}">{{end}}<img class="avatar mr-3 {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{$author_page.Title}}">{{if $profile_url}}</a>{{end}}
{{ end }}
<div class="media-body">
<h5 class="card-title"><a href="{{$profile_url}}">{{$author_page.Title}}</a></h5>
<h5 class="card-title">{{if $profile_url}}<a href="{{$profile_url}}">{{end}}{{$author_page.Title}}{{if $profile_url}}</a>{{end}}</h5>
{{ with $author_page.Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}}
{{ with $author_page.Params.bio }}<p class="card-text">{{. | markdownify | emojify}}</p>{{end}}
{{ partial "social_links" $author_page }}

View file

@ -2,14 +2,14 @@
{{- $taxonomy := "authors" }}
{{ if .Param $taxonomy }}
{{ $link_authors := site.Params.link_authors | default true }}
{{ range $index, $value := (.GetTerms $taxonomy) }}
{{- /* Highlight the author's name? */ -}}
{{- $highlight_name := .Page.Params.highlight_name | default false -}}
{{- if gt $index 0 }}, {{ end -}}
<span {{ if $highlight_name }}class="author-highlighted"{{end}}>
{{- if $link_authors -}}
{{/* Effectively check the page's `_build` option as `_build` is not exposed in Hugo's Page object. */}}
{{- if .RelPermalink -}}
<a href="{{.RelPermalink}}">{{.LinkTitle}}</a>
{{- else -}}
{{ .LinkTitle }}

View file

@ -23,7 +23,7 @@
{{ $hide_published_with_footer := site.Params.power_ups.hide_published_with | default true }}
{{ if not (and $is_sponsor $hide_published_with_footer) }}
Published with
<a href="https://wowchemy.com" target="_blank" rel="noopener">Wowchemy</a>
<a href="https://wowchemy.com/?utm_campaign=poweredby" target="_blank" rel="noopener">Wowchemy</a>
the free, <a href="https://github.com/wowchemy/wowchemy-hugo-modules" target="_blank" rel="noopener">
open source</a> website builder that empowers creators.
{{ end }}