diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 23f18e3..e28c761 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -47,6 +47,11 @@ params: author: NexT 主题 subtitle: 为 Hugo 打造的主题 description: 保持简单的易用性和强大的功能。 + # Custom logo will use in open graph image's URL + # Use the "show" variable to control whether it is displayed in the sidebar + customLogo: + show: true + url: /imgs/hugo-next-logo.png favicon: icon: /imgs/icons/favicon.ico @@ -54,6 +59,28 @@ params: medium: /imgs/icons/favicon-32x32-next.png appleTouchIcon: /imgs/icons/apple-touch-icon-next.png + # Open graph settings + openGraph: + enable: true + #twitter: + # card: + # creator: + # image: + # site: + #googlePlus: + #facebook: + # admins: + # app_id: + + # Sidebar Avatar + avatar: + # Replace the default image and set the url here. + url: /imgs/hugo-next-avatar.png + # If true, the avatar will be displayed in circle. + rounded: true + # If true, the avatar will be rotated with the cursor. + rotated: true + # Creative Commons 4.0 International License. # See: https://creativecommons.org/about/cclicenses/ creativeCommons: @@ -68,12 +95,4 @@ params: # No setting is required here and can be done by multilanguage # language: deed.zh - # Sidebar Avatar - avatar: - # Replace the default image and set the url here. - url: /imgs/hugo-next-avatar.png - # If true, the avatar will be displayed in circle. - rounded: true - # If true, the avatar will be rotated with the cursor. - rotated: true diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 54e1931..12d78e7 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,5 @@ -{{ $langCode := replaceRE "-([a-z]+)" (upper (substr .Site.Language -3)) .Site.Language }} -{{ $P := .Site.Params }} +{{- $langCode := replaceRE "-([a-z]+)" (upper (substr .Site.Language -3)) .Site.Language -}} +{{- $P := .Site.Params -}} @@ -7,18 +7,7 @@ - {{ partial "partials/head.html" . }} - - - - - - - - - - {{- $style := resources.Get "css/style.css" | resources.ExecuteAsTemplate "css/style.css" . -}} - + {{- partial "partials/head.html" . }} {{ .Site.Title }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 1ebce2b..264e1e8 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,9 +1,4 @@ - - - - -{{/**/}} - - - - \ No newline at end of file +{{- partial "head/favicon.html" . }} +{{- partial "head/open_graph.html" . }} +{{ partial "head/css.html" . }} +{{- partial "head/analytics.html" . }} \ No newline at end of file diff --git a/layouts/partials/head/analytics.html b/layouts/partials/head/analytics.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html new file mode 100644 index 0000000..6aca96f --- /dev/null +++ b/layouts/partials/head/css.html @@ -0,0 +1,6 @@ + + + + +{{- $style := resources.Get "css/style.css" | resources.ExecuteAsTemplate "css/style.css" . }} + \ No newline at end of file diff --git a/layouts/partials/head/favicon.html b/layouts/partials/head/favicon.html new file mode 100644 index 0000000..f956361 --- /dev/null +++ b/layouts/partials/head/favicon.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/layouts/partials/head/open_graph.html b/layouts/partials/head/open_graph.html new file mode 100644 index 0000000..39a1f8a --- /dev/null +++ b/layouts/partials/head/open_graph.html @@ -0,0 +1,33 @@ +{{- $Site := .Site -}} +{{- $Params := .Site.Params -}} +{{- $Page := .Page -}} +{{- with .Site.Params.openGraph -}} +{{- if .enable -}} +{{- $langCode := replaceRE "-([a-z]+)" (upper (substr $Site.Language -3)) $Site.Language }} + + + + + + + + + +{{- with .twitter -}} +{{- range $attr, $val := . }} + +{{- end -}} +{{- end -}} + +{{- with .googlePlus }} + +{{- end -}} + +{{- with .facebook -}} +{{- range $attr, $val := . }} + +{{- end -}} +{{- end -}} + +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index bcc1f57..ca2a735 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -14,6 +14,11 @@

{{ .Site.Params.subtitle }}

+ {{ with .Site.Params.customLogo }} + {{ if .show }} + Custom Logo + {{ end }} + {{ end }}