From 9e6238bf034e05a75be4591e030c7fa945838c17 Mon Sep 17 00:00:00 2001 From: wangbudui Date: Thu, 9 Jan 2020 16:21:40 +0800 Subject: [PATCH] content prepare over --- config.toml | 27 ++++++++++++++--- .../_default/_markup/render-image.html | 13 +++++++++ themes/hugo-w2ng/layouts/_default/baseof.html | 2 +- themes/hugo-w2ng/layouts/_default/single.html | 9 ++++++ themes/hugo-w2ng/layouts/partials/footer.html | 11 ++++++- themes/hugo-w2ng/layouts/partials/head.html | 29 +++++++++++++++++-- 6 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 themes/hugo-w2ng/layouts/_default/_markup/render-image.html diff --git a/config.toml b/config.toml index 2cac9a0..7f52978 100644 --- a/config.toml +++ b/config.toml @@ -1,14 +1,33 @@ -baseURL = "http://example.org/" -languageCode = "en-us" -title = "My New Hugo Site" +baseURL = "https://wrong.wang/" +languageCode = "zh-CN" +title = "wrong.wang" theme = "hugo-w2ng" pygmentsStyle="github" hasCJKLanguage = true enableEmoji = true +googleAnalytics = "UA-120056178-1" +copyright = "This work is licensed under a CC BY-NC 4.0(署名-非商业性使用 4.0 国际) License." + +[author] + name = "王锐" + +disableKinds = ["taxonomyTerm"] + [params] - Footer = "© 2019 王不对 - **[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/)** - **[RSS](/index.xml)**" + description = "王不对的个人网站" + Footer = "© 2019 王不对 - **[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/)** - **[RSS](/blog/index.xml)**" HomeDesc = "**[博客](/blog/) 和 [飞行手册](/flight-rules/)中还有很多文章✨**" AuthorName = "王不对" + Favicon = "/favicon.jpg" + +[params.CDN] +#enable = false +enable = true +# Host must end with `/` +Host = "https://lowentropy.jinxiapu.cn/img/" + +[params.comments.isso] +Host = "https://c.jinxiapu.cn/" [[menu.main]] name = "博客" diff --git a/themes/hugo-w2ng/layouts/_default/_markup/render-image.html b/themes/hugo-w2ng/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..849cbc9 --- /dev/null +++ b/themes/hugo-w2ng/layouts/_default/_markup/render-image.html @@ -0,0 +1,13 @@ +{{- $img_destination := .Destination }} +{{ if .Page.Site.Params.CDN.enable }} + {{ $img_destination = (print .Page.Site.Params.CDN.HOST .Page.File.Dir "/" .Destination) }} +{{ end }} + +{{ if .Title -}} +
+ {{ $.Text }} +
{{ with $.Title | safeHTML }}{{ . }}{{ end }}
+
+{{- else }} + {{ $.Text }} +{{ end -}} \ No newline at end of file diff --git a/themes/hugo-w2ng/layouts/_default/baseof.html b/themes/hugo-w2ng/layouts/_default/baseof.html index dfd9888..218b33b 100644 --- a/themes/hugo-w2ng/layouts/_default/baseof.html +++ b/themes/hugo-w2ng/layouts/_default/baseof.html @@ -1,5 +1,5 @@ - + {{- partial "head.html" . -}} diff --git a/themes/hugo-w2ng/layouts/_default/single.html b/themes/hugo-w2ng/layouts/_default/single.html index 31903bc..cef9dab 100644 --- a/themes/hugo-w2ng/layouts/_default/single.html +++ b/themes/hugo-w2ng/layouts/_default/single.html @@ -21,5 +21,14 @@
{{ .Content }}
+ {{- if (and .IsPage .Params.comment | default true ) -}} +
+
+ {{ with .Page.Site.Params.comments.isso.Host }} + + {{ end }} + {{ end }} {{ end }} \ No newline at end of file diff --git a/themes/hugo-w2ng/layouts/partials/footer.html b/themes/hugo-w2ng/layouts/partials/footer.html index d29ad46..043ef0f 100644 --- a/themes/hugo-w2ng/layouts/partials/footer.html +++ b/themes/hugo-w2ng/layouts/partials/footer.html @@ -4,4 +4,13 @@ {{ .Page.Site.Params.Footer | markdownify }}

- \ No newline at end of file + + +{{- if (and .IsPage .Params.math) -}} + + + +{{- end -}} + + \ No newline at end of file diff --git a/themes/hugo-w2ng/layouts/partials/head.html b/themes/hugo-w2ng/layouts/partials/head.html index 8fd3c2a..535fc13 100644 --- a/themes/hugo-w2ng/layouts/partials/head.html +++ b/themes/hugo-w2ng/layouts/partials/head.html @@ -1,8 +1,33 @@ -{{ if .Site.IsServer }} + + + + + + + + + +{{ hugo.Generator }} + +{{ if eq .RelPermalink "/" }} +{{ .Site.Title }} +{{ else }} +{{- .Title -}}{{- with .Params.subtitle -}} - {{- . -}} {{- end }} - {{ .Site.Title -}} +{{ end }} + +{{- if .Site.IsServer -}} {{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/dev/postcss.config.js") }} {{ else }} {{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }} {{ end }} - \ No newline at end of file + + + +{{ template "_internal/schema.html" . }} +{{ template "_internal/opengraph.html" . }} +{{ template "_internal/twitter_cards.html" . -}} +{{ if not $.Site.IsServer }} +{{ template "_internal/google_analytics_async.html" . }} +{{ end }} \ No newline at end of file