Add post: 暗黑能天使
This commit is contained in:
80
layouts/partials/components/opengraph.html
Normal file
80
layouts/partials/components/opengraph.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<meta property="og:title" content="{{ partial "get-title" . }}" />
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
||||
{{ $icon := partial "utils/get-image" (dict "context" . "url" .Site.Params.icon) }}
|
||||
{{ with $icon }}
|
||||
<meta property="og:image" content="{{ . }}">
|
||||
{{ end }}
|
||||
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
|
||||
{{ with .Params.audio }}
|
||||
<meta property="og:audio" content="{{ . | absURL }}" />
|
||||
{{ end }}
|
||||
{{ with .Description }}
|
||||
<meta property="og:description" content="{{ . }}" />
|
||||
{{ else }}
|
||||
{{if .IsPage}}
|
||||
<meta property="og:description" content="{{ .Summary }}" />
|
||||
{{ else }}
|
||||
{{ with .Site.Params.Description }}
|
||||
<meta property="og:description" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.LanguageCode }}
|
||||
<meta property="og:locale" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ if .IsTranslated }}
|
||||
{{ range .Translations }}
|
||||
<meta property="og:locale:alternate" content="{{ .Lang }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Title }}
|
||||
<meta property="og:site_name" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.videos }}
|
||||
{{ range . }}
|
||||
<meta property="og:video" content="{{ . | absURL }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsPage }}
|
||||
{{ if not .PublishDate.IsZero }}
|
||||
<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ else if not .Date.IsZero }}
|
||||
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ end }}
|
||||
{{ if not .Lastmod.IsZero }}
|
||||
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ if not .Date.IsZero }}
|
||||
<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<meta property="article:section" content="{{ .Section }}" />
|
||||
{{ with .Params.tags }}
|
||||
{{ range first 6 . }}
|
||||
<meta property="article:tag" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .GetTerms "series" }}
|
||||
{{ $pageLink := .Permalink }}
|
||||
{{ $series := .Site.Taxonomies.series}}
|
||||
{{ range (.GetTerms "series") }}
|
||||
{{ range .Pages }}
|
||||
{{ if ne .Page.Permalink $pageLink }}
|
||||
<meta property="og:see_also" content="{{ .Page.Permalink }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else if (.Site.RegularPages.Related .) }}
|
||||
{{ range (.Site.RegularPages.Related . | first 6) }}
|
||||
<meta property="og:see_also" content="{{ .Page.Permalink }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user