Improve SEO and code formatting

This commit is contained in:
2021-04-08 15:05:17 +02:00
parent c6fbd73a16
commit 16261320d9
17 changed files with 309 additions and 213 deletions
+23 -58
View File
@@ -1,82 +1,47 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author"
content="{{ if .Params.author }}{{ .Params.author }}{{ else }}{{ range .Site.Author }}{{ . }} {{ end }}{{ end }}">
<meta name="description"
content="{{ if .IsHome }}{{ .Site.Params.homeSubtitle }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta name="keywords"
content="{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}" />
<meta name="robots" content="noodp" />
<!-- <meta name="theme-color" content="{{ .Site.Params.themeColor }}" /> -->
<link rel="canonical" href="{{ .Permalink }}" />
<link rel="canonical" href="{{ .Permalink }}" />
<link rel="preload" href="{{ .Site.BaseURL }}fonts/Inter-UI-Regular.woff2" as="font" type="font/woff2"
crossorigin="anonymous">
<link rel="preload" href="{{ .Site.BaseURL }}fonts/Inter-UI-Bold.woff2" as="font" type="font/woff2"
crossorigin="anonymous">
{{ block "title" . }}
<title>
{{ if .IsHome }}
{{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }} {{ end }}
{{ else }}
{{ .Title }} :: {{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }}{{ end }}
{{ end }}
</title>
{{ end }}
{{ $options := (dict "targetPath" "main.css" "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "scss/main.scss" | resources.ToCSS $options | resources.Fingerprint }}
{{- $style := resources.Get "scss/main.scss" | resources.ToCSS $options | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ range $val := $.Site.Params.customCSS }}
{{ if gt (len $val) 0 }}
{{- range $val := $.Site.Params.customCSS }}
{{- if gt (len $val) 0 }}
<link rel="stylesheet" type="text/css" href="{{ $val }}">
{{ end }}
{{ end }}
{{- end }}
{{- end }}
<!-- Icons -->
{{- partial "favicons.html" . }}
{{- partial "favicons.html" . -}}
{{ template "_internal/schema.html" . }}
{{ template "_internal/twitter_cards.html" . }}
{{ if isset .Site.Taxonomies "series" }}
{{ template "_internal/opengraph.html" . }}
{{ end }}
{{ range .Params.categories }}
<meta property="article:section" content="{{ . }}" />
{{ end }}
{{ if isset .Params "date" }}
<meta property="article:published_time" content="{{ time .Date }}" />
{{ end }}
<!-- Meta tags -->
{{- partial "meta-tags.html" . -}}
<!-- RSS -->
{{ with .OutputFormats.Get "rss" -}}
<!-- {{- with .OutputFormats.Get "rss" }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
{{- end }} -->
<link rel="alternate" type="application/rss+xml" href="{{ "/posts/index.xml" | absURL }}" title="{{ $.Site.Title }}" />
<!-- JSON Feed -->
{{ if .OutputFormats.Get "json" }}
{{- if .OutputFormats.Get "json" }}
<link href="{{ if .OutputFormats.Get "json" }}{{ .Site.BaseURL }}feed.json{{ end }}" rel="alternate"
type="application/json" title="{{ .Site.Title }}" />
{{ end }}
{{- end }}
{{ if .Site.GoogleAnalytics }}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.GoogleAnalytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '{{ .Site.GoogleAnalytics }}');
</script>
{{ end }}
{{- block "title" . }}
<title>
{{- if .IsHome }}
{{- $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }} {{ end }}
{{- else }}
{{- .Title }} :: {{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }}{{ end }}
{{- end -}}
</title>
{{- end }}