head: improve the metadata exposed

* Improves the metadata exposed, such as site or post description, site
  or post image. Make use of <https://matuzo.at/blog/html-boilerplate>.
* Removes extra empty lines or identation due to badly written layout.
  However, minifying at build could be a good idea.
* Improves very slightly the webmanifest file.

Co-Authored-by: iGor milhit <igor@milhit.ch>
merge-requests/4/head
iGor milhit 2021-05-04 21:34:58 +02:00
parent 029a3ac174
commit e7de77b3ad
Signed by: igor
GPG Key ID: 692D97C3D0228A99
5 changed files with 81 additions and 59 deletions

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ .Language.Lang }}" prefix="og: http://ogp.me/ns#"> <html lang="{{ .Language.Lang }}" prefix="og: http://ogp.me/ns#">
{{- partial "head.html" . -}} {{ partial "head.html" . }}
<body> <body>
{{- partial "header.html" . -}} {{- partial "header.html" . -}}
<main class="container"> <main class="container">
{{- block "main" . }}{{- end }} {{- block "main" . }}{{- end }}
</main> </main>
{{- partial "footer.html" . -}} {{- partial "footer.html" . -}}
</body> </body>
</html> </html>

View File

@ -1,21 +1,21 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width">
<title>{{ .Title }} | {{ .Site.Title }}</title> <title>{{ .Title }} - {{ .Site.Title }}</title>
<link rel="canonical" href="{{ .Permalink }}"> <link rel="canonical" href="{{ .Permalink }}">
{{- partial "metadata.html" . -}} {{- if .Site.IsServer -}}
{{ if .Site.IsServer }} {{- $options := (dict "targetPath" "styles.css" "enableSourceMap" true) -}}
{{ $options := (dict "targetPath" "styles.css" "enableSourceMap" true) }} {{- $styles := resources.Get "scss/main.scss" | toCSS $options }}
{{ $styles := resources.Get "scss/main.scss" | toCSS $options }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen"> <link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
{{ else }} {{- else -}}
{{ $options := (dict "targetPath" "styles.css") }} {{- $options := (dict "targetPath" "styles.css") -}}
{{ $styles := resources.Get "scss/main.scss" | toCSS $options | minify }} {{- $styles := resources.Get "scss/main.scss" | toCSS $options | minify -}}
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen"> <link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
{{ end }} {{- end }}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}} {{ end }}
{{ partial "metadata.html" . -}}
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">

View File

@ -1,35 +1,57 @@
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"> <meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Personal portfolio{{ end }}">
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/"> <meta property="og:title" content="{{ .Title }} - {{ .Site.Title }}">
<meta property="og:site_name" content="{{ .Site.Title }}"> <meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:url" content="{{ .Permalink }}"> <meta property="og:description" content="{{ if .Params.description }}{{ .Params.description }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Personal portfolio{{ end }}">
<meta name="DC.creator" content="{{ .Site.Author.name }}"> {{ if .Params.postimage -}}
<meta name="DC.language" content="{{ .Language.Lang }}"> <meta property="og:image" content="{{ .Site.BaseURL }}images/{{ .Params.postimage }}">
{{ if .IsNode }} {{- else if .Site.Params.Image -}}
<meta property="og:image" content="{{ .Site.BaseURL }}images/{{ .Site.Params.Image }}">
{{- else -}}
<meta property="og:image" content="{{ .Site.BaseURL }}images/site.jpg">
{{ end }}
{{ if .Params.postimagedescription -}}
<meta property="og:image:alt" content="{{ .Params.postimagedescription }}">
{{- else if .Site.Params.ImageDescription -}}
<meta property="og:image:alt" content="{{ .Site.Params.ImageDescription }}">
{{- else -}}
<meta property="og:image:alt" content="Grayish sheep portrait">
{{ end }}
<meta property="og:locale" content="{{ .Language.Lang }}">
{{- if .IsNode }}
<meta property="og:type" content="website">
{{- else }}
<meta property="og:type" content="blogPost">
{{ end -}}
<meta name="twitter:card" content="summary_large_image" />
<meta property="og:url" content="{{ .Permalink }}">
<link rel="canonical" href="{{ .Permalink }}">
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/">
<meta name="DC.creator" content="{{ .Site.Author.name }}">
<meta name="DC.language" content="{{ .Language.Lang }}">
{{- if .IsNode }}
<meta name="DC.title" content="{{ .Site.Title }}"> <meta name="DC.title" content="{{ .Site.Title }}">
{{ end }} {{ end }}
{{ if .IsPage }} {{- if .IsPage }}
<meta name="DC.type" content="blogPost"> <meta name="DC.type" content="blogPost">
<meta name="DC.title" content="{{ .Page.Title }}"> <meta name="DC.title" content="{{ .Page.Title }}">
<meta name="DC.created" <meta name="DC.created" content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}"> <meta name="DC.date" content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
<meta name="DC.date" {{- if (and (isset .Params "lastmod") (gt (dateFormat "2016-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
{{ if (and (isset .Params "lastmod") (gt (dateFormat "2016-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
<meta name="DC.modified" content="{{ .Lastmod }}"> <meta name="DC.modified" content="{{ .Lastmod }}">
{{ end }} {{ end -}}
<meta name="og:article:published_time" <meta name="og:article:published_time" content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}"> {{- if (and (isset .Params "lastmod") (gt (dateFormat "2016-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
{{ if (and (isset .Params "lastmod") (gt (dateFormat "2016-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
<meta name="og.article:modified_time" content="{{ .Lastmod }}"> <meta name="og.article:modified_time" content="{{ .Lastmod }}">
{{ end }} {{ end -}}
{{ with .Params.categories }} {{- with .Params.categories }}
{{ range . }} {{- range . -}}
<meta name="DC.subject" content="{{ . }}"> <meta name="DC.subject" content="{{ . }}">
{{ end }} {{- end -}}
{{ end }} {{ end -}}
{{ with .Params.tags }} {{- with .Params.tags }}
{{ range . }} {{- range . -}}
<meta name="DC.subject" content="{{ . }}"> <meta name="DC.subject" content="{{ . }}">
{{ end }} {{ end -}}
{{ end }} {{ end -}}
{{ end }} {{ end -}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -1,6 +1,6 @@
{ {
"name": "", "name": "iGor milhit",
"short_name": "", "short_name": "iG",
"icons": [ "icons": [
{ {
"src": "/android-chrome-192x192.png", "src": "/android-chrome-192x192.png",