website/layouts/partials/head_meta_opengraph.html

43 lines
1.7 KiB
HTML

<meta property="og:site_name"
content='{{ .Site.Title | default "Ficurinia" }}' />
{{ if .IsPage }}
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:type" content="article" />
<meta
property="article:author" content="{{ .Site.Params.Author }}" />
<meta
property="article:published_time"
content='{{ .Date.Format "2006-01-02T15:04:05Z-0700" }}' />
{{ if .Params.tags }}
{{ range sort .Params.tags }}
<meta property="article:tag" content="{{ . }}" />
{{ end }}
{{ end }}
<meta property="og:url" content="{{ .Permalink }}" />
{{ $image := .Site.Params.icon512 | default "/img/icon.svg" }}
{{ if .Params.Image }}
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
{{ $image = .Params.Image }}
{{ else }}
{{ $image = path.Join (path.Join .File.Dir .Params.Image) }}
{{ end }}
{{ end }}
<meta property="og:image"
content="{{ $image | absURL }}" />
{{ if .Params.description }}
<meta property="og:description" content="{{ .Params.description }}" />
{{ else }}
<meta property="og:description" content="{{ substr .Summary 0 160 }}" />
{{ end }}
{{ else }}
<meta property="og:title"
content='{{ .Site.Title | default "Ficurinia" }}' />
{{ if .Site.Params.description }}
<meta property="og:description" content="{{ .Site.Params.description }}" />
{{ end }}
<meta property="og:type" content="blog" />
<meta property="og:image"
content='{{ .Site.Params.icon512 | default "/img/icon.svg" | absURL }}' />
{{ end }}