diff options
author | Wang Chucheng <ccwangchn@gmail.com> | 2020-10-31 19:52:14 +0300 |
---|---|---|
committer | Wang Chucheng <ccwangchn@gmail.com> | 2020-10-31 19:52:14 +0300 |
commit | bb0f2edf07004f98d1bed6472f043467ad38774a (patch) | |
tree | 7d878df4a346453e6598b8ce4332f4ae5bbe4be6 /layouts | |
parent | 687bca9d0c01dca46e931a5a87004d3ec0af594d (diff) |
refactor: improve google fonts
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/head.html | 36 | ||||
-rw-r--r-- | layouts/partials/header.html | 2 | ||||
-rw-r--r-- | layouts/partials/schema.html | 39 | ||||
-rw-r--r-- | layouts/partials/widgets/about.html | 4 |
4 files changed, 42 insertions, 39 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index ab140f9..81daf0e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,16 +1,6 @@ <meta charset="utf-8"> -<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no"> +<meta name="viewport" content="width=device-width"> <title>{{ with .Params.Title }}{{ . }} | {{ end }}{{ .Site.Title }}</title> -{{ with .Site.Params.icon }} -<link rel="icon" type="image/png" sizes="32x32" href="{{ (partial "get_icon" (dict "icon" . "size" 32)).Permalink }}"> -<link rel="apple-touch-icon" sizes="180x180" href="{{ (partial "get_icon" (dict "icon" . "size" 180)).Permalink }}"> -{{ end }} - -{{ define "partials/get_icon" }} -{{ $icon := resources.GetMatch .icon }} -{{ $icon_resized := $icon.Fill (printf "%sx%s Center" (string .size) (string .size)) }} -{{ return $icon_resized }} -{{ end }} {{ $css := .Site.Data.assets.css }} {{ $js := .Site.Data.assets.js }} @@ -38,14 +28,28 @@ <script defer src="{{ $eureka_js.Permalink }}"></script> {{ end }} -<link +<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin=""> +<link rel="preload" href="https://fonts.googleapis.com/css2?family=Lora:wght@400;600;700&family=Noto+Serif+SC:wght@400;600;700&display=swap" - rel="stylesheet"> -<link rel="stylesheet" - href="{{ printf $css.highlight.url $css.highlight.version }}"> + as="style" onload="this.onload=null;this.rel='stylesheet'"> +<link rel="preload" href="{{ printf $css.highlight.url $css.highlight.version }}" as="style" + onload="this.onload=null;this.rel='stylesheet'"> <script defer src="{{ printf $js.highlight.url $js.highlight.version }}"></script> -<script async src="{{ printf $js.fontawesome.url $js.fontawesome.version }}" integrity="{{ $js.fontawesome.sri }}" crossorigin="anonymous"></script> +<script async src="{{ printf $js.fontawesome.url $js.fontawesome.version }}" integrity="{{ $js.fontawesome.sri }}" + crossorigin="anonymous"></script> {{ template "_internal/google_analytics_async.html" . }} + +{{ with .Site.Params.icon }} +<link rel="icon" type="image/png" sizes="32x32" href="{{ (partial "get_icon" (dict "icon" . "size" 32)).Permalink }}"> +<link rel="apple-touch-icon" sizes="180x180" href="{{ (partial "get_icon" (dict "icon" . "size" 180)).Permalink }}"> +{{ end }} + +{{ define "partials/get_icon" }} +{{ $icon := resources.GetMatch .icon }} +{{ $icon_resized := $icon.Fill (printf "%sx%s Center" (string .size) (string .size)) }} +{{ return $icon_resized }} +{{ end }} + {{ partial "schema.html" . }} {{ partial "opengraph.html" . }} {{ range .AlternativeOutputFormats -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 0ac9971..399bec7 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -9,7 +9,7 @@ </script> <nav class="flex items-center justify-between flex-wrap p-4"> <a href="{{ "/" | absLangURL }}" class="mr-6 text-primary-text text-xl font-bold">{{ .Site.Title }}</a> - <button id="navbar-btn" class="md:hidden flex items-center px-3 py-2"> + <button id="navbar-btn" class="md:hidden flex items-center px-3 py-2" aria-label="Open Navbar"> <i class="fas fa-bars"></i> </button> diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html index bb018d6..8521726 100644 --- a/layouts/partials/schema.html +++ b/layouts/partials/schema.html @@ -1,5 +1,4 @@ -<meta itemprop="name" content="{{ with .Params.Title }}{{ . }} | {{ end }}{{ .Site.Title }}"> -<meta itemprop="description" +<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ end }}"> {{ if not .IsHome }} @@ -34,25 +33,25 @@ {{ template "breadcrumb" (dict "p1" .p1.Site.Home "p2" .p2 "depth" $depth) -}} {{ end -}} {{ if eq .p1 .p2 -}} - { - "@type": "ListItem", - "position": {{ .depth }}, - "name": {{ .p1.Title }}, - "item": {{ .p1.Permalink }} - } +{ +"@type": "ListItem", +"position": {{ .depth }}, +"name": {{ .p1.Title }}, +"item": {{ .p1.Permalink }} +} {{- else if eq .depth 1 -}} - { - "@type": "ListItem", - "position": {{ .depth }}, - "name": {{ .p1.Site.Title }}, - "item": {{ .p1.Permalink }} - }, +{ +"@type": "ListItem", +"position": {{ .depth }}, +"name": {{ .p1.Site.Title }}, +"item": {{ .p1.Permalink }} +}, {{- else -}} - { - "@type": "ListItem", - "position": {{ .depth }}, - "name": {{ .p1.Title }}, - "item": {{ .p1.Permalink }} - }, +{ +"@type": "ListItem", +"position": {{ .depth }}, +"name": {{ .p1.Title }}, +"item": {{ .p1.Permalink }} +}, {{- end -}} {{- end -}}
\ No newline at end of file diff --git a/layouts/partials/widgets/about.html b/layouts/partials/widgets/about.html index ab612d4..465ec52 100644 --- a/layouts/partials/widgets/about.html +++ b/layouts/partials/widgets/about.html @@ -6,7 +6,7 @@ </div> {{ end }} <div class="flex-grow mt-4 md:mt-0"> - <div class="text-6xl font-medium leading-tight py-4">{{ .Title }}</div> + <div class="text-6xl leading-tight py-4">{{ .Title }}</div> <div class="w-3/12 xl:w-2/12 border-b"></div> <div class="flex items-center pt-4"> @@ -26,7 +26,7 @@ </div> {{ with .Params.bio }} - <div class="py-8 text-lg leading-normal font-medium"> + <div class="py-8 text-lg leading-normal"> {{ . }} </div> {{ end }} |