diff options
author | uPagge <git@upagge.ru> | 2021-03-28 23:02:21 +0300 |
---|---|---|
committer | uPagge <git@upagge.ru> | 2021-03-28 23:02:21 +0300 |
commit | ac7d24045de07c7152e945e64d45601c644e6a2b (patch) | |
tree | 4931cbac038d3e010d6684d7cc75ea078d3697f9 /layouts/partials | |
parent | 1c7142279d8713023f1c9b07819b0ba9806ce64b (diff) |
html5
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/head/seo.html | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index 1b13b9c..9f007d0 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -16,9 +16,11 @@ <meta name="baidu-site-verification" content="{{ . }}" /> {{- end -}} +{{- /* Home SEO */ -}} +{{- if .IsHome -}} +{{- end -}} -{{- /* Home SEO */ -}} {{- if .IsHome -}} <script type="application/ld+json"> { @@ -62,6 +64,46 @@ {{- with .Site.Copyright -}} "license": "{{ . | safeHTML }}", {{- end -}} + {{- if .Site.Params.home.profile.social -}} + "sameAs": [ + {{- $socialMap := resources.Get "data/social.yml" | transform.Unmarshal -}} + {{- $socialArr := slice -}} + {{- range $key, $value := .Site.Params.social -}} + {{- $social := $key | lower | index $socialMap | default dict -}} + {{- if and $value (ne $key "email") (ne $key "rss") -}} + {{- if reflect.IsMap $value -}} + {{- with $value.weight -}} + {{- $social = dict "Weight" . | merge $social -}} + {{- end -}} + {{- with $value.prefix -}} + {{- $social = dict "Prefix" . | merge $social -}} + {{- end -}} + {{- with $value.template -}} + {{- $social = dict "Template" . | merge $social -}} + {{- end -}} + {{- with $value.id -}} + {{- $social = dict "Id" . | merge $social -}} + {{- end -}} + {{- with $value.url -}} + {{- $social = dict "Url" . | merge $social -}} + {{- end -}} + {{- else if ne $value true -}} + {{- $social = dict "Id" $value | merge $social -}} + {{- end -}} + {{- $socialArr = $socialArr | append $social -}} + {{- end -}} + {{- end -}} + {{- $len := (len $socialArr) -}} + {{- range $index, $value := $socialArr -}} + {{- $template := .Template | default "%v" -}} + {{- with .Prefix -}} + {{- $template = . | strings.TrimSuffix "/" | printf "%v/%%v" -}} + {{- end -}} + {{- printf (string $template) .Id | safeHTML -}} + {{- if ne (add $index 1) $len -}}, {{- end -}} + {{- end -}} + ], + {{- end -}} "name": {{ .Site.Title | safeHTML }} } </script> |