Merge partials for head and add logic so they can be added once in baseof instead of in each single and list template.
This commit is contained in:
parent
e8c04dfc8e
commit
9eea6f46a9
13 changed files with 31 additions and 115 deletions
|
|
@ -4,11 +4,11 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>{{ block "title" . }}{{ .Title }} – {{ .Site.Title }}{{ end }}</title>
|
<title>{{ block "title" . }}{{ .Title }} – {{ .Site.Title }}{{ end }}</title>
|
||||||
{{ block "meta" . }}{{ end }}
|
{{ partial "meta.html" . }}
|
||||||
{{- partial "meta.html" . -}}
|
{{ partialCached "styles.html" . }}
|
||||||
{{- partialCached "styles.html" . -}}
|
{{- block "head" . }}{{ end }}
|
||||||
{{ block "header" . }}{{ end }}
|
{{ partial "meta_json_ld.html" . }}
|
||||||
{{ partial "scripts.html" . -}}
|
{{ partial "scripts.html" . }}
|
||||||
{{ if and .Site.Params.piwikTrackerUrl .Site.Params.piwikSiteID }}{{ partialCached "matomo.html" . }}{{ end -}}
|
{{ if and .Site.Params.piwikTrackerUrl .Site.Params.piwikSiteID }}{{ partialCached "matomo.html" . }}{{ end -}}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
@ -20,8 +20,8 @@
|
||||||
<a href="{{ "/" | relLangURL }}" title="Home" class="header__site-link" rel="home"><span>{{ .Site.Title }}</span></a>
|
<a href="{{ "/" | relLangURL }}" title="Home" class="header__site-link" rel="home"><span>{{ .Site.Title }}</span></a>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="region header__region">
|
<div class="region header__region">
|
||||||
{{ if .Site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end }}
|
{{ if .Site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end -}}
|
||||||
{{ if $.Param "search" }}{{ partialCached "search.html" . }}{{ end }}
|
{{ if $.Param "search" }}{{ partialCached "search.html" . }}{{ end -}}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
{{ block "main" . }}{{ end }}
|
{{ block "main" . }}{{ end }}
|
||||||
|
|
||||||
{{ if $.Param "sidebar" | default true }}{{ partial "sidebar.html" . -}}{{ end }}
|
{{ if $.Param "sidebar" | default true }}{{ partial "sidebar.html" . }}{{ end -}}
|
||||||
|
|
||||||
<footer class="footer layout__footer">
|
<footer class="footer layout__footer">
|
||||||
{{ if $.Param "feedlinks" }}{{ partial "feedlinks.html" . }}{{ end -}}
|
{{ if $.Param "feedlinks" }}{{ partial "feedlinks.html" . }}{{ end -}}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,3 @@
|
||||||
{{ define "meta" }}
|
|
||||||
{{- partial "section_meta.html" . -}}
|
|
||||||
{{- partial "opengraph_meta.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "header" }}
|
|
||||||
{{- partial "section_json_ld.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main">
|
<main class="main layout__main">
|
||||||
<h1 class="title">{{ .Title }}</h1>
|
<h1 class="title">{{ .Title }}</h1>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,3 @@
|
||||||
{{ define "meta" }}
|
|
||||||
{{- partial "single_meta.html" . -}}
|
|
||||||
{{- partial "opengraph_meta.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "header" }}
|
|
||||||
{{- partial "single_json_ld.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main">
|
<main class="main layout__main">
|
||||||
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
{{ define "title" }}{{ .Site.Title }}{{ end }}
|
{{ define "title" }}{{ .Site.Title }}{{ end }}
|
||||||
|
|
||||||
{{ define "meta" }}
|
|
||||||
{{- partial "section_meta.html" . -}}
|
|
||||||
{{- partial "single_meta.html" . -}}
|
|
||||||
{{- partial "opengraph_meta.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "header" }}
|
|
||||||
{{- partial "section_json_ld.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main">
|
<main class="main layout__main">
|
||||||
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,3 @@
|
||||||
{{ define "meta" }}
|
|
||||||
{{- partial "section_meta.html" . -}}
|
|
||||||
{{- partial "opengraph_meta.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "header" }}
|
|
||||||
{{- partial "section_json_ld.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main">
|
<main class="main layout__main">
|
||||||
<h1 class="title">Micro posts</h1>
|
<h1 class="title">Micro posts</h1>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
{{ define "meta" }}
|
|
||||||
{{- partial "single_meta.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "header" }}
|
|
||||||
{{- partial "single_json_ld.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main">
|
<main class="main layout__main">
|
||||||
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
|
{{ range .AlternativeOutputFormats -}}
|
||||||
|
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" title="{{ .Name }}" href="{{ .Permalink | safeURL }}">
|
||||||
|
{{ end -}}
|
||||||
|
<meta name="description" content="{{ if .IsPage }}{{ .Description | default (replaceRE "\n" " " .Summary) }}{{ else }}{{ $.Param "description" }}{{ end }}">
|
||||||
|
<meta name="created" content="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">
|
||||||
|
<meta name="modified" content="{{ .Lastmod.Format "2006-01-02T15:04:05-0700" }}">
|
||||||
|
{{ with $.Param "author" }}<meta name="author" content="{{ . }}">{{ end }}
|
||||||
|
<meta property="og:site_name" content="{{ .Site.Title }}">
|
||||||
|
<meta property="og:title" content="{{ .Title }}">
|
||||||
|
<meta property="og:url" content="{{ .Permalink }}">
|
||||||
|
{{ with $.Param "image" }}<meta name="og:image" content="{{ . | absURL }}">{{ end }}
|
||||||
{{ hugo.Generator }}
|
{{ hugo.Generator }}
|
||||||
{{ with $.Param "contact" }}<meta name="contact" content="{{ . }}">{{ end }}
|
{{ with $.Param "contact" }}<meta name="contact" content="{{ . }}">{{ end }}
|
||||||
<meta name="msapplication-TileColor" content="{{ $.Param "themecolor" | default "#ffffff" }}">
|
<meta name="msapplication-TileColor" content="{{ $.Param "themecolor" | default "#ffffff" }}">
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,24 @@
|
||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
"@context": "http://schema.org",
|
"@context": "https://schema.org",
|
||||||
|
{{ if .IsPage -}}
|
||||||
|
"@type": {{ if or (eq .Section "blog") (eq .Section "post") }}"BlogPosting"{{ else }}"WebPage"{{ end }},
|
||||||
|
"headline": {{ .Title }},
|
||||||
|
"datePublished": {{ .Date.Format "2006-01-02T15:04:05Z07:00" }},
|
||||||
|
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }},
|
||||||
|
"url" : {{ .Permalink }},
|
||||||
|
"description": {{ with (.Description | default (replaceRE "\n" " " .Summary)) }}{{ . }}{{ end }},
|
||||||
|
{{ with .Params.tags -}}
|
||||||
|
"keywords": {{ . }},
|
||||||
|
{{ end -}}
|
||||||
|
{{ else -}}
|
||||||
"@type": "WebPage",
|
"@type": "WebPage",
|
||||||
"url" : {{ .Permalink }},
|
"url" : {{ .Permalink }},
|
||||||
"name": {{ .Title }},
|
"name": {{ .Title }},
|
||||||
{{ with $.Param "description" -}}
|
{{ with $.Param "description" -}}
|
||||||
"description": {{ . }},
|
"description": {{ . }},
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
{{ with $.Param "image" -}}
|
{{ with $.Param "image" -}}
|
||||||
"image" : {{ . | absURL }},
|
"image" : {{ . | absURL }},
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
@ -22,7 +34,7 @@
|
||||||
},
|
},
|
||||||
"publisher": {
|
"publisher": {
|
||||||
"@type": "Organization",
|
"@type": "Organization",
|
||||||
"name": {{ .Site.Title }},
|
"name": {{ .Site.Title }},
|
||||||
{{ with $.Param "icon" -}}
|
{{ with $.Param "icon" -}}
|
||||||
"logo" : {
|
"logo" : {
|
||||||
"@type": "ImageObject",
|
"@type": "ImageObject",
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{{ if .IsPage -}}
|
|
||||||
<meta name="description" content="{{ .Description | default (replaceRE "\n" " " .Summary) }}">
|
|
||||||
{{ else -}}
|
|
||||||
<meta name="description" content="{{ $.Param "description" }}">
|
|
||||||
{{ end -}}
|
|
||||||
<meta property="og:site_name" content="{{ .Site.Title }}">
|
|
||||||
<meta property="og:title" content="{{ .Title }}">
|
|
||||||
<meta property="og:url" content="{{ .Permalink }}">
|
|
||||||
{{ with $.Param "image" }}<meta name="og:image" content="{{ . | absURL }}">{{ end }}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{{ range .AlternativeOutputFormats -}}
|
|
||||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" title="{{ .Name }}" href="{{ .Permalink | safeURL }}">
|
|
||||||
{{ end -}}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<meta name="created" content="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">
|
|
||||||
<meta name="modified" content="{{ .Lastmod.Format "2006-01-02T15:04:05-0700" }}">
|
|
||||||
{{ with $.Param "author" }}<meta name="author" content="{{ . }}">{{ end }}
|
|
||||||
|
|
@ -1,12 +1,3 @@
|
||||||
{{ define "meta" }}
|
|
||||||
{{- partial "single_meta.html" . -}}
|
|
||||||
{{- partial "opengraph_meta.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "header" }}
|
|
||||||
{{- partial "single_json_ld.html" . -}}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main">
|
<main class="main layout__main">
|
||||||
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue