Initial commit
This commit is contained in:
30
layouts/partials/head/opengraph.html
Executable file
30
layouts/partials/head/opengraph.html
Executable file
@@ -0,0 +1,30 @@
|
||||
{{- $title := .Title | default .Site.Title -}}
|
||||
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
|
||||
{{- $image := .Params.image | default "/images/og-default.png" -}}
|
||||
{{- if not (strings.HasPrefix $image "http") -}}
|
||||
{{- $image = $image | absURL -}}
|
||||
{{- end -}}
|
||||
|
||||
<meta property="og:title" content="{{ $title }}">
|
||||
<meta property="og:description" content="{{ $desc }}">
|
||||
<meta property="og:type" content="{{ cond (eq .Section "tracks") "music.song" "website" }}">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
<meta property="og:site_name" content="{{ .Site.Title }}">
|
||||
<meta property="og:locale" content="en_US">
|
||||
|
||||
{{- if $image }}
|
||||
<meta property="og:image" content="{{ $image }}">
|
||||
<meta property="og:image:alt" content="{{ $title }}">
|
||||
{{- end }}
|
||||
|
||||
{{/* Audio-specific OpenGraph tags */}}
|
||||
{{- if and (eq .Section "tracks") .Params.audio }}
|
||||
<meta property="og:audio" content="{{ .Params.audio }}">
|
||||
<meta property="og:audio:type" content="audio/mpeg">
|
||||
{{- if .Params.duration }}
|
||||
<meta property="music:duration" content="{{ .Params.duration }}">
|
||||
{{- end }}
|
||||
{{- if .Params.artist }}
|
||||
<meta property="music:musician" content="{{ .Params.artist }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user