sync theme
This commit is contained in:
parent
867a3c0c44
commit
48cd01768b
43 changed files with 727 additions and 320 deletions
|
@ -0,0 +1,47 @@
|
|||
{{- $imgs := slice }}
|
||||
{{- $imgParams := .Params.images }}
|
||||
{{- $resources := .Resources.ByType "image" -}}
|
||||
{{/* Find featured image resources if the images parameter is empty. */}}
|
||||
{{- if not $imgParams }}
|
||||
{{- $featured := $resources.GetMatch "*feature*" -}}
|
||||
{{- if not $featured }}{{ $featured = $resources.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{- with $featured }}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"Image" .
|
||||
"RelPermalink" .RelPermalink
|
||||
"Permalink" .Permalink) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{/* Use the first one of site images as the fallback. */}}
|
||||
{{- if and (not $imgParams) (not $imgs) }}
|
||||
{{- with site.Params.images }}
|
||||
{{- $imgParams = first 1 . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{/* Parse page's images parameter. */}}
|
||||
{{- range $imgParams }}
|
||||
{{- $img := . }}
|
||||
{{- $url := urls.Parse $img }}
|
||||
{{- if eq $url.Scheme "" }}
|
||||
{{/* Internal image. */}}
|
||||
{{- with $resources.GetMatch $img -}}
|
||||
{{/* Image resource. */}}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"Image" .
|
||||
"RelPermalink" .RelPermalink
|
||||
"Permalink" .Permalink) }}
|
||||
{{- else }}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"RelPermalink" (relURL $img)
|
||||
"Permalink" (absURL $img)
|
||||
) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{/* External image */}}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"RelPermalink" $img
|
||||
"Permalink" $img
|
||||
) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $imgs }}
|
|
@ -10,18 +10,10 @@
|
|||
{{- end}}
|
||||
{{- else }}
|
||||
|
||||
{{- with $.Params.images -}}
|
||||
{{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
|
||||
{{- else -}}
|
||||
{{- $images := $.Resources.ByType "image" -}}
|
||||
{{- $featured := $images.GetMatch "*feature*" -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{- with $featured -}}
|
||||
<meta property="og:image" content="{{ $featured.Permalink }}"/>
|
||||
{{- else -}}
|
||||
{{- with site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $images := partial "partials/templates/_funcs/get-page-images" . -}}
|
||||
{{- range first 6 $images }}
|
||||
<meta property="og:image" content="{{ .Permalink }}" />
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if .IsPage }}
|
||||
|
@ -41,12 +33,27 @@
|
|||
{{- /* If it is part of a series, link to related articles */}}
|
||||
{{- $permalink := .Permalink }}
|
||||
{{- $siteSeries := site.Taxonomies.series }}
|
||||
{{- if $siteSeries }}
|
||||
{{ with .Params.series }}{{- range $name := . }}
|
||||
{{- $series := index $siteSeries ($name | urlize) }}
|
||||
{{- range $page := first 6 $series.Pages }}
|
||||
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
|
||||
{{- end }}
|
||||
{{ end }}{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
|
||||
{{- $facebookAdmin := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- $facebookAdmin = .facebook_admin }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Social.facebook_admin }}
|
||||
{{- $facebookAdmin = . }}
|
||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Facebook Page Admin ID for Domain Insights */}}
|
||||
{{- with site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"@context": "https://schema.org",
|
||||
"@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}",
|
||||
"name": {{ site.Title }},
|
||||
"url": {{ site.BaseURL }},
|
||||
"url": {{ site.Home.Permalink }},
|
||||
"description": {{ site.Params.description | plainify | truncate 180 | safeHTML }},
|
||||
"thumbnailUrl": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }},
|
||||
"sameAs": [
|
||||
|
@ -18,7 +18,7 @@
|
|||
</script>
|
||||
{{- else if (or .IsPage .IsSection) }}
|
||||
{{/* BreadcrumbList */}}
|
||||
{{- $url := replace .Parent.Permalink ( printf "%s" site.BaseURL) "" }}
|
||||
{{- $url := replace .Parent.Permalink ( printf "%s" site.Home.Permalink) "" }}
|
||||
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
|
||||
{{- $bc_list := (split $lang_url "/")}}
|
||||
|
||||
|
@ -80,6 +80,11 @@
|
|||
{{- else -}}
|
||||
{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }},
|
||||
{{- end}}
|
||||
{{- else }}
|
||||
{{- $images := partial "partials/templates/_funcs/get-page-images" . -}}
|
||||
{{- with index $images 0 -}}
|
||||
"image": {{ .Permalink }},
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
"datePublished": {{ .PublishDate }},
|
||||
"dateModified": {{ .Lastmod }},
|
||||
|
|
|
@ -6,28 +6,33 @@
|
|||
<meta name="twitter:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
|
||||
{{- end}}
|
||||
{{- else }}
|
||||
{{- with $.Params.images -}}
|
||||
<meta name="twitter:card" content="summary_large_image"/>
|
||||
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
|
||||
{{ else -}}
|
||||
{{- $images := $.Resources.ByType "image" -}}
|
||||
{{- $featured := $images.GetMatch "*feature*" -}}
|
||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{- with $featured -}}
|
||||
<meta name="twitter:card" content="summary_large_image"/>
|
||||
<meta name="twitter:image" content="{{ $featured.Permalink }}"/>
|
||||
{{- $images := partial "partials/templates/_funcs/get-page-images" . -}}
|
||||
{{- with index $images 0 -}}
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:image" content="{{ .Permalink }}" />
|
||||
{{- else -}}
|
||||
{{- with site.Params.images -}}
|
||||
<meta name="twitter:card" content="summary_large_image"/>
|
||||
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
|
||||
{{ else -}}
|
||||
<meta name="twitter:card" content="summary"/>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
<meta name="twitter:title" content="{{ .Title }}"/>
|
||||
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
|
||||
{{ with site.Social.twitter -}}
|
||||
<meta name="twitter:site" content="@{{ . }}"/>
|
||||
{{ end -}}
|
||||
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
|
||||
{{- $twitterSite := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- $twitterSite = .twitter }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Social.twitter }}
|
||||
{{- $twitterSite = . }}
|
||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with $twitterSite }}
|
||||
{{- $content := . }}
|
||||
{{- if not (strings.HasPrefix . "@") }}
|
||||
{{- $content = printf "@%v" $twitterSite }}
|
||||
{{- end }}
|
||||
<meta name="twitter:site" content="{{ $content }}"/>
|
||||
{{- end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue