diff options
Diffstat (limited to 'layouts/partials/head.html')
-rw-r--r-- | layouts/partials/head.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..de32ad1 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,51 @@ +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + {{ if .IsHome -}} + <title>{{ .Site.Title }} | {{ .Site.Params.subtitle}}</title> + <meta property="og:title" content="{{ .Site.Title }} | {{ .Site.Params.subtitle}}"> + <meta property="og:type" content="website"> + {{ if .Site.Params.keywords }} + <meta name="Keywords" content="{{.Site.Params.keywords}}"> + {{ end }} + {{ if .Site.Params.keywords }} + <meta name="description" content="{{ .Site.Params.description }}"> + {{ end }} + {{- else -}} + <title>{{ .Title }} | {{ .Site.Title }}</title> + <meta property="og:title" content="{{ .Title }} - {{ .Site.Title }}"> + <meta property="og:type" content="article"> + {{ with .Params.date }} + <meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05+08:00" }}"> + {{ end }} + {{ with .Params.lastmod }} + <meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05+08:00" }}"> + {{ end }} + <meta name="Keywords" content="{{ if .Keywords }}{{ .Keywords }}{{ else }}{{ .Site.Params.keywords }}{{ end }}"> + <meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Title }}{{ end }}"> + {{ if .Params.author -}} + <meta name="author" content="{{ .Params.author }}"> + {{- end }} + {{- end }} + + {{ $options := (dict "outputStyle" "compressed" "includePaths" (slice "sass")) }} + {{ $lightScss := resources.Get "css/hulga.scss" }} + {{ $darkScss := resources.Get "css/hulga-dark.scss" }} + {{ if .Site.Params.postcss }} + {{ $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options | postCSS | resources.Minify }} + <link rel="stylesheet" type="text/css" href="{{ $light.Permalink | relURL }}"> + {{ if .Site.Params.darkMedia }} + {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | postCSS | resources.Minify }} + <link rel="stylesheet" type="text/css" href="{{ $dark.Permalink | relURL }}" media="(prefers-color-scheme: dark)"> + {{ end }} + {{ else }} + {{ $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options }} + <link rel="stylesheet" type="text/css" href="{{ $light.Permalink | relURL }}"> + {{ if .Site.Params.darkMedia }} + {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options }} + <link rel="stylesheet" type="text/css" href="{{ $dark.Permalink | relURL }}" media="(prefers-color-scheme: dark)"> + {{ end }} + {{ end }} + +</head> |