mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-12-29 08:56:17 -05:00
38891b9062
If an article has a `canonicalUrl` set, Originally published at `<hostname>` will be displayed at the top of the article by setting `showCanonicalLink` to true. Usage => In front-matter: canonicalUrl: "<URL>" showCanonicalLink: true
10 lines
603 B
HTML
10 lines
603 B
HTML
{{ if and (.Params.canonicalURL) (.Params.ShowCanonicalLink ) -}}
|
|
{{ $url := urls.Parse .Params.canonicalURL }}
|
|
|
|
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated (or .Params.editPost.URL .Site.Params.editPost.URL) }} | {{- end -}}
|
|
<span>
|
|
{{- (.Site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Originally published at" -}}
|
|
<a href="{{ trim .Params.canonicalURL " " }}" title="{{ trim .Params.canonicalURL " " }}" target="_blank" rel="noopener noreferrer">{{ $url.Host }}</a>
|
|
</span>
|
|
{{- end }}
|