hugo-snotra/layouts/partials/opengraph.html

39 lines
1.4 KiB
HTML
Raw Permalink Normal View History

2020-04-28 12:26:34 +02:00
<meta name="twitter:card" content="summary_large_image"/>
2020-04-28 21:49:52 +02:00
{{ with .Site.Params.twitterUser }}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end }}
2020-04-28 12:26:34 +02:00
<meta name="twitter:title" content="{{ .Title }}"/>
{{ if .Description }}
<meta name="twitter:description" content="{{ .Description }}"/>
{{ else }}
<meta name="twitter:description" content="{{ .Site.Params.description }}"/>
{{ end }}
<meta property="og:title" content="{{ .Title }}" />
{{ if .Description }}
<meta property="og:description" content="{{ .Description }}"/>
{{ else }}
<meta property="og:description" content="{{ .Site.Params.description }}"/>
{{ end }}
{{ if eq .Kind "page" }}
<meta property="og:type" content="article" />
{{ else }}
<meta property="og:type" content="website" />
{{ end }}
<meta property="og:url" content="{{ .Permalink }}" />
{{ $title := .Title }}
{{if .Params.images }}
{{ $baseUrl := .Permalink }}
{{ $altText := i18n "alt_image" }}
{{ range first 1 .Params.images }}
<meta property="og:image" content="{{ $baseUrl }}{{ . }}"/>
<meta property="og:image:alt" content="{{ $altText }} {{ $title }}"/>
{{ end }}
{{ else }}
<meta property="og:image" content="{{ .Site.BaseURL }}images/avatar.png"/>
<meta property="og:image:alt" content="{{ i18n "alt_avatar" . }}"/>
{{ end }}
2024-10-13 18:27:42 +02:00
<meta property="og:updated_time" content="{{ .Site.Lastmod }}" />
2020-04-28 12:26:34 +02:00
<meta property="og:site_name" content="{{ .Site.Title }}" />