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>
<html lang="{{ .Language.Lang }}" prefix="og: http://ogp.me/ns#">
{{- partial "head.html" . -}}
<body>
{{ partial "head.html" . }}
<body>
{{- partial "header.html" . -}}
<main class="container">
{{- block "main" . }}{{- end }}
</main>
{{- partial "footer.html" . -}}
</body>
</body>
</html>

View File

@ -1,21 +1,21 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ .Title }} | {{ .Site.Title }}</title>
<meta name="viewport" content="width=device-width">
<title>{{ .Title }} - {{ .Site.Title }}</title>
<link rel="canonical" href="{{ .Permalink }}">
{{- partial "metadata.html" . -}}
{{ if .Site.IsServer }}
{{ $options := (dict "targetPath" "styles.css" "enableSourceMap" true) }}
{{ $styles := resources.Get "scss/main.scss" | toCSS $options }}
{{- if .Site.IsServer -}}
{{- $options := (dict "targetPath" "styles.css" "enableSourceMap" true) -}}
{{- $styles := resources.Get "scss/main.scss" | toCSS $options }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
{{ else }}
{{ $options := (dict "targetPath" "styles.css") }}
{{ $styles := resources.Get "scss/main.scss" | toCSS $options | minify }}
{{- else -}}
{{- $options := (dict "targetPath" "styles.css") -}}
{{- $styles := resources.Get "scss/main.scss" | toCSS $options | minify -}}
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
{{ end }}
{{ range .AlternativeOutputFormats -}}
{{- end }}
{{ range .AlternativeOutputFormats }}
{{ 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="icon" type="image/png" sizes="32x32" href="/favicon-32x32.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/">
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/">
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:url" content="{{ .Permalink }}">
<meta name="DC.creator" content="{{ .Site.Author.name }}">
<meta name="DC.language" content="{{ .Language.Lang }}">
{{ if .IsNode }}
<meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Personal portfolio{{ end }}">
<meta property="og:title" content="{{ .Title }} - {{ .Site.Title }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:description" content="{{ if .Params.description }}{{ .Params.description }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Personal portfolio{{ end }}">
{{ if .Params.postimage -}}
<meta property="og:image" content="{{ .Site.BaseURL }}images/{{ .Params.postimage }}">
{{- 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 }}">
{{ end }}
{{ if .IsPage }}
{{ end }}
{{- if .IsPage }}
<meta name="DC.type" content="blogPost">
<meta name="DC.title" content="{{ .Page.Title }}">
<meta name="DC.created"
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
<meta name="DC.date"
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.created" content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
<meta name="DC.date" 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 }}">
{{ end }}
<meta name="og:article:published_time"
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
{{ if (and (isset .Params "lastmod") (gt (dateFormat "2016-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
{{ end -}}
<meta name="og:article:published_time" 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="og.article:modified_time" content="{{ .Lastmod }}">
{{ end }}
{{ with .Params.categories }}
{{ range . }}
{{ end -}}
{{- with .Params.categories }}
{{- range . -}}
<meta name="DC.subject" content="{{ . }}">
{{ end }}
{{ end }}
{{ with .Params.tags }}
{{ range . }}
{{- end -}}
{{ end -}}
{{- with .Params.tags }}
{{- range . -}}
<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": "",
"short_name": "",
"name": "iGor milhit",
"short_name": "iG",
"icons": [
{
"src": "/android-chrome-192x192.png",