summaryrefslogtreecommitdiff
path: root/layouts/partials/head
diff options
context:
space:
mode:
authorArne Rief <riearn@proton.me>2025-08-16 22:42:03 +0200
committerArne Rief <riearn@proton.me>2025-08-16 22:42:03 +0200
commitf0506acd6f70da636b8fdb23439c85bbf2392b40 (patch)
treed9c4082aafa3e20a37174beecadcab54286f9cd9 /layouts/partials/head
parent1bf4d8aca6f81f2dddd0262e74b278cd9985b53d (diff)
HTML templates done
Diffstat (limited to 'layouts/partials/head')
-rw-r--r--layouts/partials/head/meta.html21
-rw-r--r--layouts/partials/head/seo.html86
2 files changed, 54 insertions, 53 deletions
diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html
index d0358a1..f739838 100644
--- a/layouts/partials/head/meta.html
+++ b/layouts/partials/head/meta.html
@@ -1,22 +1,27 @@
-<!-- Basic Meta -->
+{{- /* Basic Meta */ -}}
<meta name="author" content="{{ site.Params.author.name | default site.Title }}">
<meta name="robots" content="index, follow">
-<!-- Open Graph (OG) -->
+{{- /* Open Graph */ -}}
<meta property="og:title" content="{{ .Title | default site.Title }}">
<meta property="og:description" content="{{ .Description | default .Summary }}">
<meta property="og:type" content="{{ if .IsHome }}website{{ else }}article{{ end }}">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:site_name" content="{{ site.Title }}">
-{{- with .Params.images }}
- <meta property="og:image" content="{{ (index . 0) | absURL }}">
+{{- with site.Params.logo }}
+ <meta property="og:image" content="{{ . | absURL }}">
+{{- end }}
+{{- if .IsPage }}
+ <meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
+ {{- with .Lastmod }}
+ <meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
+ {{- end }}
{{- end }}
-<!-- Twitter Card -->
+{{- /* Twitter Card */ -}}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ .Title | default site.Title }}">
<meta name="twitter:description" content="{{ .Description | default .Summary }}">
-{{- with .Params.images }}
- <meta name="twitter:image" content="{{ (index . 0) | absURL }}">
+{{- with site.Params.logo }}
+ <meta name="twitter:image" content="{{ . | absURL }}">
{{- end }}
-
diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html
index 2c617e1..628ea2c 100644
--- a/layouts/partials/head/seo.html
+++ b/layouts/partials/head/seo.html
@@ -1,50 +1,46 @@
-{{ if .IsPage }}
- <script type="application/ld+json">
- {
- "@context": "https://schema.org",
- "@type": "Article",
- "headline": {{ printf "%q" .Title }},
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "{{ if .IsPage }}Article{{ else }}WebSite{{ end }}",
+ "url": {{ .Permalink }},
+ "name": {{ with .Title }}{{ . }}{{ else }}{{ site.Title }}{{ end }},
+ "headline": {{ with .Title }}{{ . }}{{ else }}{{ site.Title }}{{ end }},
+ "description": {{ with .Description }}{{ . }}{{ else }}{{ site.Params.description | default site.Title }}{{ end }},
+ {{- with .Params.images }}
+ "image": [
+ {{- range $i, $image := . }}
+ {{- if $i }},{{ end }}
+ "{{ $image | absURL }}"
+ {{- end }}
+ ],
+ {{- else }}
+ {{- with site.Params.logo }}
+ "image": ["{{ . | absURL }}"],
+ {{- end }}
+ {{- end }}
+ {{- if .IsPage }}
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}",
- {{ with .Lastmod }}
- "dateModified": "{{ .Format "2006-01-02T15:04:05Z07:00" }}",
- {{ end }}
- "author": {
- "@type": "Person",
- "name": {{ printf "%q" (site.Params.author.name | default site.Title) }}
- },
- "publisher": {
- "@type": "Person",
- "name": {{ printf "%q" site.Title }},
- "logo": {
- "@type": "ImageObject",
- "url": "{{ site.Params.logo | absURL }}"
- }
+ {{- with .Lastmod }}
+ "dateModified": "{{ .Format "2006-01-02T15:04:05Z07:00" }}",
+ {{- end }}
+ {{- end }}
+ "author": {
+ "@type": "Person",
+ "name": "{{ site.Params.author.name | default site.Title }}"
+ },
+ "publisher": {
+ "@type": "Organization",
+ "name": "{{ site.Title }}"
+ {{- with site.Params.logo }},
+ "logo": {
+ "@type": "ImageObject",
+ "url": "{{ . | absURL }}"
+ }
+ {{- end }}
},
"mainEntityOfPage": {
"@type": "WebPage",
- "@id": "{{ .Permalink }}"
- },
- "image": [
- {{ with .Params.images }}"{{ (index . 0) | absURL }}"{{ end }}
- ]
- }
- </script>
-{{ else if .IsHome }}
- <script type="application/ld+json">
- {
- "@context": "https://schema.org",
- "@type": "WebSite",
- "url": "{{ site.BaseURL }}",
- "name": {{ printf "%q" site.Title }},
- "author": {
- "@type": "Person",
- "name": {{ printf "%q" (site.Params.author.name | default site.Title) }}
- },
- "publisher": {
- "@type": "Person",
- "name": {{ printf "%q" site.Title }}
- }
+ "@id": {{ .Permalink }}
}
- </script>
-{{ end }}
-
+}
+</script>