diff options
author | wlh <wanglinghao18z@ict.ac.cn> | 2020-11-27 13:52:01 +0300 |
---|---|---|
committer | wlh <wanglinghao18z@ict.ac.cn> | 2020-11-27 13:52:01 +0300 |
commit | 539caeec7c7dc5fac4fb0ff872e639262b495f69 (patch) | |
tree | 2e8328747653e20aeccaae04a2e5e391e47f9317 | |
parent | c414042c405993903f5bd5fb990bf727b4df39aa (diff) |
add meta tag params to readme
-rw-r--r-- | README.md | 21 | ||||
-rw-r--r-- | layouts/404.html | 26 | ||||
-rw-r--r-- | layouts/partials/backtotop.html | 3 | ||||
-rw-r--r-- | layouts/partials/footer.html | 2 | ||||
-rw-r--r-- | layouts/partials/head.html | 74 | ||||
-rw-r--r-- | layouts/partials/highlight.html | 1 | ||||
-rw-r--r-- | layouts/partials/math.html | 40 | ||||
-rw-r--r-- | layouts/partials/nav.html | 4 | ||||
-rw-r--r-- | layouts/partials/navburger.html | 2 |
9 files changed, 83 insertions, 90 deletions
@@ -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 @@ <body> <div id="main"> - <!-- {{- partial "nav.html" . -}} --> - <!-- {{- partial "header.html" . -}} --> - {{- block "404-main" . }}{{- end }} + <article class="message is-primary is-large"> + <div class="message-header"> + <p>404 Page Not Found</p> + </div> + <div class="message-body"> + <p>{{ i18n "404-info" }}</p> + </div> + </article> </div> - <!-- {{- partial "footer.html" . -}} --> - <!-- {{- partial "backtotop.html" . -}} --> - <!-- {{- block "script" . }}{{- end }} --> </body> -</html> -{{ define "404-main" }} -<article class="message is-primary is-large"> - <div class="message-header"> - <p>404 Page Not Found</p> - </div> - <div class="message-body"> - <p>{{ i18n "404-info" }}</p> - </div> -</article> -{{ end }} +</html>
\ 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: '<svg viewBox="0 0 24 24"><path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/></svg>', 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 @@ </footer> {{ 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 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"> - <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"> - <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"> - <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"> - <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"> - <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"> - <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"> - <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"> - <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"> - <link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png"> - <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> - <link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"> - <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <meta name="msapplication-TileImage" content="/ms-icon-144x144.png"> {{- if .Site.Params.primaryColor -}} <meta name="msapplication-TileColor" content="{{.Site.Params.primaryColor}}"> <meta name="theme-color" content="{{.Site.Params.primaryColor}}"> {{- end -}} - {{ if .IsHome -}} - <title>{{ .Site.Title }} | {{ .Site.Params.subtitle}}</title> + {{- 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}}"> + <meta name="keywords" content="{{.Site.Params.keywords}}"> {{ end }} - {{ if .Site.Params.keywords }} + {{ if .Site.Params.description }} <meta name="description" content="{{ .Site.Params.description }}"> {{ end }} {{- else -}} @@ -40,33 +27,44 @@ {{ 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="keywords" content="{{ if .Keywords }}{{ .Keywords }}{{ else }}{{ .Site.Params.keywords }}{{ end }}"> <meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Title }}{{ end }}"> - {{ if .Params.author -}} + {{- end -}} + {{ if .Site.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="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> + <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> + <link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"> + <link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png"> + <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"> + <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"> + <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"> + <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"> + <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"> + <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"> + <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"> + <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"> + <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"> + {{- $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 }} + {{- 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 | resources.Minify }} + {{- end }} + {{- else }} + {{- $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options | 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 | resources.Minify }} + {{- if .Site.Params.darkMedia }} + {{- $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | resources.Minify }} <link rel="stylesheet" type="text/css" href="{{ $dark.Permalink | relURL }}" media="(prefers-color-scheme: dark)"> - {{ end }} - {{ end }} - {{ if .Site.Params.pwa }} + {{- end }} + {{- end }} + {{- if .Site.Params.pwa }} <link rel="manifest" href="/manifest.json"> - {{ end }} - + {{- end }} </head>
\ 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 + } ] }); }); -</script> +</script>
\ 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 @@ <nav class="navbar is-primary"> <div class="container"> <div class="navbar-brand"> - <a class="navbar-item {{if ne .Kind "page"}}fake-text{{end}}" href="/"> - {{.Site.Title }} + <a class="navbar-item {{if ne .Kind "page"}}fake-text{{end}}" href="{{ .Site.BaseURL }}"> + {{ .Site.Title }} </a> <a role="button" class="navbar-burger" data-target="navMenu" aria-label="menu" aria-expanded="false"> <span aria-hidden="true"></span> diff --git a/layouts/partials/navburger.html b/layouts/partials/navburger.html index dc1e157..f782173 100644 --- a/layouts/partials/navburger.html +++ b/layouts/partials/navburger.html @@ -18,4 +18,4 @@ }); } }); -</script> +</script>
\ No newline at end of file |