hugo_frigg/layouts/partials/opengraph.html

38 lines
1.4 KiB
HTML

<meta name="twitter:card" content="summary_large_image"/>
{{ with .Site.Params.twitterUser }}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end }}
<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 }}
<meta property="og:updated_time" content="{{ .Site.LastChange }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />