From 539caeec7c7dc5fac4fb0ff872e639262b495f69 Mon Sep 17 00:00:00 2001 From: wlh Date: Fri, 27 Nov 2020 18:52:01 +0800 Subject: add meta tag params to readme --- README.md | 21 +++++++----- layouts/404.html | 26 +++++---------- layouts/partials/backtotop.html | 3 +- layouts/partials/footer.html | 2 +- layouts/partials/head.html | 74 ++++++++++++++++++++--------------------- layouts/partials/highlight.html | 1 - layouts/partials/math.html | 40 +++++++++++----------- layouts/partials/nav.html | 4 +-- layouts/partials/navburger.html | 2 +- 9 files changed, 83 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index b8ced1f..5b60b93 100644 --- a/README.md +++ b/README.md @@ -31,18 +31,18 @@ build hugo site with configs 1. clone to hugo site themes folder -```bash -git submodule add https://github.com/wlh320/hugo-theme-hulga.git themes/hulga -``` + ```bash + git submodule add https://github.com/wlh320/hugo-theme-hulga.git themes/hulga + ``` 2. enable it in `config.toml` -``` -theme = "hulga" -``` -and then config it. + ``` + theme = "hulga" + ``` + and then config it. -3. to use `postcss`, copy `package.json ` and `postcss.config.js` to the root of your site folder, then `npm install` +3. to use `postcss`, you should have hugo extended version installed, then copy `package.json` and `postcss.config.js` to the root of your site folder, then `npm install` ## Config @@ -57,6 +57,11 @@ paginate = 10 theme = "hulga" [params] + # show in HTML meta tag + author = "xxx" + keywords = "HTML, hugo, CSS" + description = "xxx's blog, xxx xx xxxx" + # change bulma's primary color primaryColor = "#1793d0" diff --git a/layouts/404.html b/layouts/404.html index d6499a9..c274bb2 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -4,23 +4,15 @@
- - - {{- block "404-main" . }}{{- end }} +
+
+

404 Page Not Found

+
+
+

{{ i18n "404-info" }}

+
+
- - - - -{{ define "404-main" }} -
-
-

404 Page Not Found

-
-
-

{{ i18n "404-info" }}

-
-
-{{ end }} + \ No newline at end of file diff --git a/layouts/partials/backtotop.html b/layouts/partials/backtotop.html index 23c9b16..5cf1ba7 100644 --- a/layouts/partials/backtotop.html +++ b/layouts/partials/backtotop.html @@ -8,8 +8,7 @@ addBackToTop({ diameter: 42, {{ if .Site.Params.primaryColor }} backgroundColor: {{ .Param "primaryColor" }}, -{{end}} - +{{ end }} innerHTML: '', textColor: '#fff' }); diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 7df832c..52758d7 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -12,5 +12,5 @@ {{ if .Site.Params.pwa }} {{ partial "pwa.html" . }} -{{ end}} +{{ end }} {{ template "_internal/google_analytics_async.html" . }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 4e9aac9..be8e90f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -2,32 +2,19 @@ - - - - - - - - - - - - - {{- if .Site.Params.primaryColor -}} {{- end -}} - {{ if .IsHome -}} - {{ .Site.Title }} | {{ .Site.Params.subtitle}} + {{- if .IsHome -}} + {{ .Site.Title }} | {{ .Site.Params.subtitle }} {{ if .Site.Params.keywords }} - + {{ end }} - {{ if .Site.Params.keywords }} + {{ if .Site.Params.description }} {{ end }} {{- else -}} @@ -40,33 +27,44 @@ {{ with .Params.lastmod }} {{ end }} - + - {{ if .Params.author -}} + {{- end -}} + {{ if .Site.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 }} + + + + + + + + + + + + + + {{- $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 }} - {{ if .Site.Params.darkMedia }} - {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | postCSS | resources.Minify }} + {{- if .Site.Params.darkMedia }} + {{- $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | postCSS | resources.Minify }} - {{ end }} - {{ else }} - {{ $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options | resources.Minify }} + {{- end }} + {{- else }} + {{- $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options | resources.Minify }} - {{ if .Site.Params.darkMedia }} - {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | resources.Minify }} + {{- if .Site.Params.darkMedia }} + {{- $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | resources.Minify }} - {{ end }} - {{ end }} - {{ if .Site.Params.pwa }} + {{- end }} + {{- end }} + {{- if .Site.Params.pwa }} - {{ end }} - + {{- end }} \ No newline at end of file diff --git a/layouts/partials/highlight.html b/layouts/partials/highlight.html index c10cfca..a8f3db3 100644 --- a/layouts/partials/highlight.html +++ b/layouts/partials/highlight.html @@ -13,7 +13,6 @@ var lightcss = {{"css/monokailight.css" | absURL}} // load syntax css if (window.matchMedia('(prefers-color-scheme)').media === 'not all') { - // alert('Browser doesn\'t support dark mode'); addCss(lightcss); } else if (window.matchMedia("(prefers-color-scheme: dark)").matches) { addCss(darkcss); diff --git a/layouts/partials/math.html b/layouts/partials/math.html index 8f934bd..cbf8308 100644 --- a/layouts/partials/math.html +++ b/layouts/partials/math.html @@ -12,27 +12,27 @@ renderMathInElement(document.body, { // ...options... delimiters: [{ - left: "$$", - right: "$$", - display: true - }, - { - left: "\\[", - right: "\\]", - display: true - }, - { - left: "$", - right: "$", - display: false - }, - { - left: "\\(", - right: "\\)", - display: false - } + left: "$$", + right: "$$", + display: true + }, + { + left: "\\[", + right: "\\]", + display: true + }, + { + left: "$", + right: "$", + display: false + }, + { + left: "\\(", + right: "\\)", + display: false + } ] }); }); - + \ No newline at end of file diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index 40337d1..7f365a7 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -1,8 +1,8 @@