mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 20:15:25 +00:00
refactor: JSONLD author
This commit is contained in:
1 parent
d486867326
commit
b2494b2172
3 files changed
+28
-28
No files matched your search
@@ -0,0 +1,26 @@
|
||||
{{/* Get name of primary author. */}}
|
||||
|
||||
{{ $page := . }}
|
||||
|
||||
{{/* Get publisher as fall back. */}}
|
||||
{{ $publisher := site.Params.org_name | default site.Title }}
|
||||
|
||||
{{ $author := "" }}
|
||||
{{ $author_username := "" }}
|
||||
|
||||
{{ if and (not $page.Params.authors) ($page.Scratch.Get "superuser_username") }}
|
||||
{{ $author_username = $page.Scratch.Get "superuser_username" }}
|
||||
{{ else if $page.Params.authors }}
|
||||
{{ $author = index $page.Params.authors 0 }}
|
||||
{{ $author_username = urlize $author }}
|
||||
{{ end }}
|
||||
|
||||
{{ $taxonomy := "authors" }}
|
||||
{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }}
|
||||
{{ with $profile_page }}
|
||||
{{ $author = .Params.name | default .Title }}
|
||||
{{ else }}
|
||||
{{ $author = $author | default $publisher }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $author }}
|
||||
@@ -8,20 +8,7 @@
|
||||
{{ $schema = "BlogPosting" }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Get author name. */}}
|
||||
{{ $author_username := "" }}
|
||||
{{ if and (not $page.Params.authors) ($page.Scratch.Get "superuser_username") }}
|
||||
{{ $author_username = $page.Scratch.Get "superuser_username" }}
|
||||
{{ else if $page.Params.authors }}
|
||||
{{ $author_username = index $page.Params.authors 0 }}
|
||||
{{ end }}
|
||||
{{ $author := "" }}
|
||||
{{ $taxonomy := "authors" }}
|
||||
{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }}
|
||||
{{ with $profile_page }}
|
||||
{{ $author = .Params.name | default .Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ $author := partial "functions/get_author_name" $page }}
|
||||
{{ $publisher := site.Params.org_name | default site.Title }}
|
||||
{{ $logo_url := printf "img/%s" (site.Params.logo | default "icon-512.png") | absURL }}
|
||||
|
||||
|
||||
@@ -1,20 +1,7 @@
|
||||
{{ $page := .page }}
|
||||
{{ $summary := .summary }}
|
||||
{{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
|
||||
{{/* Get author name. */}}
|
||||
{{ $author_username := "" }}
|
||||
{{ if and (not $page.Params.authors) ($page.Scratch.Get "superuser_username") }}
|
||||
{{ $author_username = $page.Scratch.Get "superuser_username" }}
|
||||
{{ else if $page.Params.authors }}
|
||||
{{ $author_username = index $page.Params.authors 0 }}
|
||||
{{ end }}
|
||||
{{ $author := "" }}
|
||||
{{ $taxonomy := "authors" }}
|
||||
{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }}
|
||||
{{ with $profile_page }}
|
||||
{{ $author = .Params.name | default .Title }}
|
||||
{{ end }}
|
||||
{{ $author := partial "functions/get_author_name" $page }}
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user