mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-27 04:03:48 +01:00
refactor(opengraph): move OpenGraph related settings to .Params.opengraph
This commit is contained in:
parent
3653d78201
commit
901d1f63fc
2 changed files with 10 additions and 7 deletions
|
@ -4,17 +4,19 @@ theme = "hugo-theme-stack"
|
|||
paginate = 5
|
||||
|
||||
[params]
|
||||
twitter = "0xJimmy"
|
||||
postSection = "post"
|
||||
emoji = "🍥"
|
||||
avatar = "img/avatar.jpg"
|
||||
logo = "/avatar.jpg"
|
||||
subtitle = "和世界分享刚编的破事"
|
||||
postLicense = "Licenced under CC BY-NC-SA 4.0"
|
||||
[params.widgets]
|
||||
enabled = ['archive', 'tag-cloud']
|
||||
[params.widgets.tagCloud]
|
||||
limit = 10
|
||||
[params.opengraph]
|
||||
defaultImage = "img/logo.png"
|
||||
[params.opengraph.twitter]
|
||||
site = "0xJimmy"
|
||||
|
||||
[menu]
|
||||
[[menu.main]]
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{- end -}}
|
||||
'>
|
||||
|
||||
{{ with .Site.Params.twitter }}
|
||||
{{ with .Site.Params.opengraph.twitter.site }}
|
||||
<meta name="twitter:site" content="{{ . }}">
|
||||
{{ end }}
|
||||
<meta name="twitter:title" content="{{ partial "data/title" . }}">
|
||||
|
@ -40,12 +40,13 @@
|
|||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
|
||||
{{- if .Params.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 name="twitter:image" content='{{ absURL $image.RelPermalink }}' />
|
||||
{{- else -}}
|
||||
<meta property='og:image' content='{{ absURL .Site.Params.logo }}' />
|
||||
{{- end -}}
|
Loading…
Reference in a new issue