commit bb5597635efd3806d9c408918aa85e01046214a9
parent 0afcf7ee365d3a77ccf7503dd149c7deeb9e57b6
Author: Lou Woell <lou.woell@posteo.de>
Date:   Sat, 13 Dec 2025 14:12:50 +0100

partial head: fix white space Situation

Diffstat:
Mlayouts/_partials/head.html | 145++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
Alayouts/_partials/ld_schema.html | 29+++++++++++++++++++++++++++++
2 files changed, 114 insertions(+), 60 deletions(-)

diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html @@ -1,105 +1,130 @@ <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> -<meta name="description" - content="{{ if .IsHome }} {{- $.Site.Params.Subtitle -}} - {{ else if .Description }} +<meta name="description" content=" + {{- if .IsHome -}} {{- $.Site.Params.Subtitle -}} + {{- else if .Description -}} {{- .Description | markdownify | plainify -}} - {{ else }} + {{- else -}} {{- .Summary | markdownify | plainify -}} - {{ end }}" /> -<meta name="keywords" content="{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}" /> -{{ if .Params.noindex }} - {{ if or (eq (.Param "noindex") true) (eq (.Param "noindex") "true") }} + {{- end -}}" /> +<meta name="keywords" content=" + {{- with .Params.Keywords -}} + {{- delimit . ", " -}} + {{- else -}} + {{- $.Site.Params.Keywords -}} + {{- end -}}" /> +{{ if .Params.noindex -}} + {{- if or (eq (.Param "noindex") true) (eq (.Param "noindex") "true") -}} <meta name="robots" content="noindex" /> - {{ end }} -{{ else }} + {{- end -}} +{{- else -}} <meta name="robots" content="noodp" /> -{{ end }} +{{- end }} <link rel="canonical" href="{{ .Permalink }}" /> -{{ template "_internal/google_analytics.html" . }} - -{{ $defaultStyles := resources.Get "css/style.scss" }} +{{- $defaultStyles := resources.Get "css/style.scss" -}} <!-- Local Theme Variables --> -{{ if and (isset .Params "color") (not (eq .Params.color "")) }} - {{ $localColorCss := resources.Get (printf "css/color/%s.scss" .Params.color) }} - {{ $localCss := slice $localColorCss $defaultStyles | resources.Concat (printf "css/%s-local.scss" .Params.color) }} - {{ $localColorStyles := $localCss | css.Sass }} +{{ if and (isset .Params "color") (not (eq .Params.color "")) -}} + {{- $localColorCss := resources.Get (printf "css/color/%s.scss" .Params.color) -}} + {{- $localCss := slice $localColorCss $defaultStyles | resources.Concat (printf "css/%s-local.scss" .Params.color) -}} + {{- $localColorStyles := $localCss | css.Sass -}} <link rel="stylesheet" href="{{ $localColorStyles.Permalink }}"> -{{ else }} +{{- else -}} <!-- Theme Variables --> - {{ $colorCss := resources.Get (printf "css/color/%s.scss" ($.Site.Params.ThemeColor | default "orange")) }} - {{ $css := slice $colorCss $defaultStyles | resources.Concat "css/base.scss" }} - {{ $options := (dict "targetPath" "styles.css" "outputStyle" "compressed" "enableSourceMap" true "precision" 6 "includePaths" (slice "node_modules")) }} - {{ $styles := $css | css.Sass $options }} - <link rel="stylesheet" href="{{ $styles.Permalink }}"> -{{ end }} + {{- $colorCss := resources.Get (printf "css/color/%s.scss" ($.Site.Params.ThemeColor | default "orange")) -}} + {{- $css := slice $colorCss $defaultStyles | resources.Concat "css/base.scss" -}} + {{- $options := (dict "targetPath" "styles.css" "outputStyle" "compressed" "enableSourceMap" true "precision" 6 "includePaths" (slice "node_modules")) -}} + {{- $styles := $css | css.Sass $options -}} + <link rel="stylesheet" href="{{ $styles.Permalink -}}"> +{{- end }} <!-- Custom CSS to override theme properties (/static/style.css) --> -{{ if (fileExists "static/style.css") -}} +{{- if (fileExists "static/style.css") -}} <link rel="stylesheet" href="{{ "style.css" | absURL }}"> -{{- end }} +{{- end -}} <!-- Icons --> -{{ if isset $.Site.Params "favicon" }} +{{- if isset $.Site.Params "favicon" -}} <link rel="shortcut icon" href="{{ $.Site.Params.favicon | absURL }}"> -{{ else }} +{{- else -}} <link rel="shortcut icon" href="{{ printf "img/theme-colors/%s.png" (or .Params.color $.Site.Params.ThemeColor | default "orange") | absURL }}"> <link rel="apple-touch-icon" href="{{ printf "img/theme-colors/%s.png" (or .Params.color $.Site.Params.ThemeColor | default "orange") | absURL }}"> -{{ end }} +{{- end }} <!-- Twitter Card --> <meta name="twitter:card" content="summary" /> -{{ if (isset $.Site.Params "twitter") }} - {{ if (isset $.Site.Params.Twitter "site") }} +{{ if (isset $.Site.Params "twitter") -}} + {{- if (isset $.Site.Params.Twitter "site") -}} <meta name="twitter:site" content="{{ $.Site.Params.Twitter.site }}" /> - {{ end }} - <meta name="twitter:creator" content="{{ if .IsHome }}{{ $.Site.Params.Twitter.creator }}{{ else if isset .Params "authortwitter" }}{{ .Params.authorTwitter }}{{ else }}{{ .Params.Author }}{{ end }}" /> -{{ end }} +<!-- ---> + {{- end -}} + <meta name="twitter:creator" content=" + {{- if .IsHome -}} + {{- $.Site.Params.Twitter.creator -}} + {{- else if isset .Params "authortwitter" -}} + {{- .Params.authorTwitter -}} + {{- else -}} + {{- .Params.Author -}} + {{- end -}}" /> +{{- end -}} <!-- OG data --> <meta property="og:locale" content="{{ $.Site.Language.Lang }}" /> -<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> -<meta property="og:title" content="{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }}{{ end }}"> -<meta property="og:description" content="{{ if .IsHome }}{{- $.Site.Params.Subtitle -}} -{{ else if .Description}} +<meta property="og:type" content=" + {{- if .IsPage -}} + article + {{- else -}} + website + {{- end }}" /> +<meta property="og:title" content=" + {{- if .IsHome -}} + {{- $.Site.Title -}} + {{- else -}} + {{- .Title -}} + {{- end }}"> +<meta property="og:description" content=" + {{- if .IsHome -}} + {{- $.Site.Params.Subtitle -}} +{{- else if .Description -}} {{- .Description | markdownify | plainify -}} -{{ else }} +{{- else -}} {{- .Summary | markdownify | plainify -}} -{{ end }}" /> +{{- end }}" /> <meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:site_name" content="{{ $.Site.Title }}" /> -{{ if (isset .Params "cover") }} - {{ $pageCover := .Param "cover" }} - {{ with (.Resources.GetMatch (.Param "cover")) }} - {{ $pageCover = .RelPermalink }} - {{ end }} +{{ if (isset .Params "cover") -}} + {{- $pageCover := .Param "cover" -}} + {{- with (.Resources.GetMatch (.Param "cover")) -}} + {{- $pageCover = .RelPermalink }} + {{- end -}} <meta property="og:image" content="{{ $pageCover | absURL }}"> -{{ else }} - {{ if isset $.Site.Params "favicon" }} +{{- else -}} + {{- if isset $.Site.Params "favicon" -}} <meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}"> - {{ else }} + {{- else -}} <meta property="og:image" content="{{ printf "img/theme-colors/%s.png" $.Site.Params.ThemeColor | absURL }}"> - {{ end }} -{{ end }} + {{- end -}} +{{- end }} <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="627"> -{{ range .Params.categories }} +{{ range .Params.categories -}} <meta property="article:section" content="{{ . }}" /> -{{ end }} -{{ if isset .Params "date" }} +{{- end }} +{{ if isset .Params "date" -}} <meta property="article:published_time" content="{{ time .Date }}" /> -{{ end }} +{{- end -}} <!-- RSS --> -{{ with .OutputFormats.Get "RSS" }} +{{ with .OutputFormats.Get "RSS" -}} <link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" /> -{{ end }} +{{- end }} <!-- JSON Feed --> -{{ with .OutputFormats.Get "json" }} +{{ with .OutputFormats.Get "json" -}} <link href="{{ .RelPermalink }}" rel="alternate" type="application/json" title="{{ $.Site.Title }}" /> -{{ end }} +{{- end }} + +{{- partial "ld_schema" . -}} <!-- Extended head section--> -{{ partial "extended_head.html" . }} +{{- partial "extended_head.html" . -}} diff --git a/layouts/_partials/ld_schema.html b/layouts/_partials/ld_schema.html @@ -0,0 +1,29 @@ +{{- if eq .Type "posts" }} + <script type="application/ld+json"> + { + "@context": "https://schema.org", + "@type": "BlogPosting", + "headline": "{{ .Params.title }}", + "datePublished": "{{ .Params.date }}", + "dateModified": "{{ .Lastmod }}", + "description": "{{ .Params.description }}" + "author": { + "@type": "Person", + "name": "lou woell", + "alternateName": "lou.", + "url": "https://repetitions.de" + }, + {{ with .Params.cover }} + "image": { + "@type": "ImageObject", + "url": "{{ . | absURL }}" + }, + {{ end }} + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "{{ .Permalink }}" + } + } + </script> +{{- end -}} +