diff options
| author | Arne Rief <riearn@proton.me> | 2025-08-08 20:50:19 +0200 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-08-08 20:50:19 +0200 |
| commit | 1bf4d8aca6f81f2dddd0262e74b278cd9985b53d (patch) | |
| tree | 9c4168e894bc52595dadd2d99b29305473f2ebcc /layouts/partials/head | |
initial commit, basic setup
Diffstat (limited to 'layouts/partials/head')
| -rw-r--r-- | layouts/partials/head/css.html | 10 | ||||
| -rw-r--r-- | layouts/partials/head/js.html | 17 | ||||
| -rw-r--r-- | layouts/partials/head/meta.html | 22 | ||||
| -rw-r--r-- | layouts/partials/head/seo.html | 50 |
4 files changed, 99 insertions, 0 deletions
diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html new file mode 100644 index 0000000..8e6c145 --- /dev/null +++ b/layouts/partials/head/css.html @@ -0,0 +1,10 @@ +{{- with resources.Get "css/main.css" }} + {{- if hugo.IsDevelopment }} + <link rel="stylesheet" href="{{ .RelPermalink }}"> + {{- else }} + {{- with . | minify | fingerprint }} + <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> + {{- end }} + {{- end }} +{{- end }} + diff --git a/layouts/partials/head/js.html b/layouts/partials/head/js.html new file mode 100644 index 0000000..6123e7f --- /dev/null +++ b/layouts/partials/head/js.html @@ -0,0 +1,17 @@ +{{- with resources.Get "js/main.js" }} + {{- $opts := dict + "minify" (not hugo.IsDevelopment) + "sourceMap" (cond hugo.IsDevelopment "external" "") + "targetPath" "js/main.js" + }} + {{- with . | js.Build $opts }} + {{- if hugo.IsDevelopment }} + <script src="{{ .RelPermalink }}"></script> + {{- else }} + {{- with . | fingerprint }} + <script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script> + {{- end }} + {{- end }} + {{- end }} +{{- end }} + diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html new file mode 100644 index 0000000..d0358a1 --- /dev/null +++ b/layouts/partials/head/meta.html @@ -0,0 +1,22 @@ +<!-- Basic Meta --> +<meta name="author" content="{{ site.Params.author.name | default site.Title }}"> +<meta name="robots" content="index, follow"> + +<!-- Open Graph (OG) --> +<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 }}"> +{{- end }} + +<!-- 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 }}"> +{{- end }} + diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html new file mode 100644 index 0000000..2c617e1 --- /dev/null +++ b/layouts/partials/head/seo.html @@ -0,0 +1,50 @@ +{{ if .IsPage }} + <script type="application/ld+json"> + { + "@context": "https://schema.org", + "@type": "Article", + "headline": {{ printf "%q" .Title }}, + "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 }}" + } + }, + "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 }} + } + } + </script> +{{ end }} + |
