refactor(opengraph): move OpenGraph related settings to .Params.opengraph
This commit is contained in:
parent
3653d78201
commit
901d1f63fc
@ -4,17 +4,19 @@ theme = "hugo-theme-stack"
|
|||||||
paginate = 5
|
paginate = 5
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
twitter = "0xJimmy"
|
|
||||||
postSection = "post"
|
postSection = "post"
|
||||||
emoji = "🍥"
|
emoji = "🍥"
|
||||||
avatar = "img/avatar.jpg"
|
avatar = "img/avatar.jpg"
|
||||||
logo = "/avatar.jpg"
|
|
||||||
subtitle = "和世界分享刚编的破事"
|
subtitle = "和世界分享刚编的破事"
|
||||||
postLicense = "Licenced under CC BY-NC-SA 4.0"
|
postLicense = "Licenced under CC BY-NC-SA 4.0"
|
||||||
[params.widgets]
|
[params.widgets]
|
||||||
enabled = ['archive', 'tag-cloud']
|
enabled = ['archive', 'tag-cloud']
|
||||||
[params.widgets.tagCloud]
|
[params.widgets.tagCloud]
|
||||||
limit = 10
|
limit = 10
|
||||||
|
[params.opengraph]
|
||||||
|
defaultImage = "img/logo.png"
|
||||||
|
[params.opengraph.twitter]
|
||||||
|
site = "0xJimmy"
|
||||||
|
|
||||||
[menu]
|
[menu]
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
'>
|
'>
|
||||||
|
|
||||||
{{ with .Site.Params.twitter }}
|
{{ with .Site.Params.opengraph.twitter.site }}
|
||||||
<meta name="twitter:site" content="{{ . }}">
|
<meta name="twitter:site" content="{{ . }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<meta name="twitter:title" content="{{ partial "data/title" . }}">
|
<meta name="twitter:title" content="{{ partial "data/title" . }}">
|
||||||
@ -40,12 +40,13 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
|
|
||||||
{{- if .Params.image -}}
|
{{- if .Params.image -}}
|
||||||
{{ $image := partial "helper/image" . }}
|
{{ $image := partial "helper/image" . }}
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta property='og:image' content='{{ absURL $image.RelPermalink }}' />
|
||||||
|
<meta name="twitter:image" content='{{ absURL $image.RelPermalink }}' />
|
||||||
|
{{- else if .Site.Params.opengraph.defaultImage -}}
|
||||||
|
{{ $image := resources.Get .Site.Params.opengraph.defaultImage }}
|
||||||
<meta property='og:image' content='{{ absURL $image.RelPermalink }}' />
|
<meta property='og:image' content='{{ absURL $image.RelPermalink }}' />
|
||||||
<meta name="twitter:image" content='{{ absURL $image.RelPermalink }}' />
|
<meta name="twitter:image" content='{{ absURL $image.RelPermalink }}' />
|
||||||
{{- else -}}
|
|
||||||
<meta property='og:image' content='{{ absURL .Site.Params.logo }}' />
|
|
||||||
{{- end -}}
|
{{- end -}}
|
Loading…
Reference in New Issue
Block a user