Use Scratch function get global variable in partial template.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
{{- $Site := .Site -}}
|
||||
{{- $Params := .Site.Params -}}
|
||||
{{- $Page := .Page -}}
|
||||
{{- $langCode := .Scratch.Get "langCode" -}}
|
||||
{{- with .Site.Params.openGraph -}}
|
||||
{{- if .enable -}}
|
||||
{{- $langCode := replaceRE "-([a-z]+)" (upper (substr $Site.Language -3)) $Site.Language }}
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="{{ $Page.Title }}">
|
||||
<meta property="og:description" content="{{ default $Params.description $Page.Description }}">
|
||||
@@ -12,7 +12,6 @@
|
||||
<meta property="og:site_name" content="{{ $Site.Title }}">
|
||||
<meta property="og:locale" content="{{ $langCode }}">
|
||||
<meta property="article:author" content="{{ default $Params.author $Page.Params.Author }}">
|
||||
|
||||
{{- with .twitter -}}
|
||||
{{- range $attr, $val := . }}
|
||||
<meta name="twitter:{{ $attr }}" content="{{ $val }}">
|
||||
|
||||
Reference in New Issue
Block a user