@ -1,8 +1,94 @@
{{- /* <!-- Breadcrumbs --> */}}
{{- $breadcrumbs := slice }}
{{- $path := "" }}
{{- if or (eq .Kind "taxonomy") (or (eq .Kind "term") (eq .Kind "404")) }}
{{- $path = .RelPermalink }}
{{- else if .File }}
{{- $path = string .File }}
{{- else if .IsHome }}
{{- $path = "" }}
{{- else }}
{{- errorf "Could not find page at url: \"%s\"!" .RelPermalink }}
{{- end }}
{{- $path = trim $path "/" }}
{{- $currentPath := "" }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" "Home" "url" $.Site.BaseURL) }}
{{- range split $path "/" }}
{{- $currentPath = printf "%s/%s" $currentPath . }}
{{- $page := $.GetPage $currentPath }}
{{- if not $.IsHome }}
{{- if ne . "_index.md" }}
{{- if eq $.Kind "404" }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" "Not Found" "url" (printf "%s%s" $.Site.BaseURL (strings.TrimLeft "/" $currentPath))) }}
{{- else }}
{{- $title := $page.Title }}
{{- if eq $page $ }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" $title "url" $page.Permalink) }}
{{- else }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" $title "url" $page.Permalink)}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .IsHome }}
< script type = "application/ld+json" >
< script type = "application/ld+json" >
{
{
"@context": "http://schema.org",
"@context": "https://schema.org",
"@graph": [
{
"@type": "Person",
"@id": "{{ $.Site.BaseURL }}#website_founder",
"name": {{ $.Site.Author.name | safeHTML }},
{{- with $.Site.Author.email }}
"email": {{ . | safeHTML }},
{{- end }}
{{- with $.Site.Author.image }}
{{- $img := resources.Get . }}
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
"image": {
"@type": "ImageObject",
"url": "{{ $img.Permalink }}",
"width": {{ $img.Width }},
"height": {{ $img.Height }}
},
{{- end }}
"url": "{{ $.Site.BaseURL }}"
},
{
"@type": "Organization",
"name": {{ $.Site.Author.name | safeHTML }},
"slogan": {{$.Site.Params.HomeSubtitle | safeHTML }},
{{- with $socials := .Site.Params.social }}
"sameAs": [
{{- range $index, $social := $socials }}
"{{ $social.url }}"{{ if ne $index (sub (len $socials) 1) }},{{ end }}
{{- end }}
],
{{- end }}
{{- with $.Site.Author.email }}
"email": {{ . | safeHTML }},
{{- end }}
{{- with $.Site.Author.image }}
{{- $img := resources.Get . }}
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
"logo": {
"@type": "ImageObject",
"url": "{{ $img.Permalink }}",
"width": {{ $img.Width }},
"height": {{ $img.Height }}
},
"image": {
"@type": "ImageObject",
"url": "{{ $img.Permalink }}",
"width": {{ $img.Width }},
"height": {{ $img.Height }}
},
{{- end }}
"url": "{{ $.Site.BaseURL }}",
"founder": { "@id": "{{ $.Site.BaseURL }}#website_founder" }
},
{
"@type": "WebSite",
"@type": "WebSite",
"inLanguage": "{{ .Site.LanguageCode }}",
"inLanguage": "{{ .Site.LanguageCode }}",
{{- $img := resources.Get .Site.Params.portrait.path }}
{{- $img := resources.Get .Site.Params.portrait.path }}
@ -18,7 +104,7 @@
],
],
"genre": "{{ .Site.Params.genre }}",
"genre": "{{ .Site.Params.genre }}",
"keywords": "{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}{{ with .Title }}, {{ delimit (split . " ") ", " }}{{ end }}{{ with .Params.Subtitle }}, {{ delimit (split . " ") ", " }}{{ end }}",
"keywords": "{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}{{ with .Title }}, {{ delimit (split . " ") ", " }}{{ end }}{{ with .Params.Subtitle }}, {{ delimit (split . " ") ", " }}{{ end }}",
"url": "{{ .Permalink }}",
"url": "{{ .Site.BaseURL }}",
{{- with .Site.Copyright }}
{{- with .Site.Copyright }}
"license": {{ . | safeHTML }},
"license": {{ . | safeHTML }},
{{- end }}
{{- end }}
@ -47,10 +133,23 @@
"headline": {{ .Site.Title }},
"headline": {{ .Site.Title }},
"alternativeHeadline": {{ .Site.Params.homeSubtitle }},
"alternativeHeadline": {{ .Site.Params.homeSubtitle }},
"description": {{ .Site.Params.description }}
"description": {{ .Site.Params.description }}
},
{
"@type": "BreadcrumbList",
"itemListElement": [
{{- range $index, $breadcrumb := $breadcrumbs }}
{
"@type": "ListItem",
"position": {{ add $index 1 }},
"item": {
"@id": "{{ $breadcrumb.url }}",
"url": "{{ $breadcrumb.url }}",
"name": "{{ $breadcrumb.name }}"
}
}
< / script >
}{{ if ne $index (sub (len $breadcrumbs) 1) }},{{ end }}
{{- else if .IsPage }}
{{- end }}
< script type = "application/ld+json" >
]
}{{ if .IsPage }},
{
{
"@context": "http://schema.org",
"@context": "http://schema.org",
"@type": "BlogPosting",
"@type": "BlogPosting",
@ -111,10 +210,7 @@
{{- end }}
{{- end }}
{{- end }}
{{- end }}
"description": {{ .Params.description | plainify }}
"description": {{ .Params.description | plainify }}
}
}{{ end }}{{ if .IsSection }},
< / script >
{{- else if .IsSection }}
< script type = "application/ld+json" >
{
{
"@context": "http://schema.org",
"@context": "http://schema.org",
"@type": "ItemList",
"@type": "ItemList",
@ -190,6 +286,7 @@
}{{ if ne (sub (len $pages) 1) $index }},{{ end }}
}{{ if ne (sub (len $pages) 1) $index }},{{ end }}
{{- end }}
{{- end }}
]
]
}{{ end }}
]
}
}
< / script >
< / script >
{{- end }}