ADD open graph protocol support
This commit is contained in:
parent
1007588f1a
commit
9d04415667
3 changed files with 55 additions and 3 deletions
|
@ -1,3 +1,35 @@
|
|||
{{ define "opengraph" }}
|
||||
<meta property="og:type" content="article" />
|
||||
{{ with .Site.LanguageCode }}
|
||||
<meta property="og:locale" content='{{ replace . "-" "_" }}' />
|
||||
{{ end }}
|
||||
<meta property="og:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}" />
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
<meta property="og:site_name" content="{{ .Site.Title }}" />
|
||||
{{ if .Params.image }}
|
||||
<meta property="og:image" content="{{ .Params.image | absURL }}" />
|
||||
{{ else }}
|
||||
<meta property="og:image" content="{{ .Site.Params.logo | absURL }}" />
|
||||
{{ end }}
|
||||
{{ if .Params.summary }}
|
||||
<meta property="og:description" content="{{ .Params.summary }}" />
|
||||
{{ else if .Content }}
|
||||
<meta property="og:description" content="{{ .Content | safeHTML | truncate 100 }}" />
|
||||
{{ else }}
|
||||
<meta property="og:description" content="{{ .Site.Params.Description }}" />
|
||||
{{ end }}
|
||||
<meta property="article:published_time" content='{{.Date.Format "2006-01-02"}}' />
|
||||
{{ with .Params.author }}
|
||||
<meta property="article:author" content="{{ . }}" />
|
||||
{{ end }}
|
||||
<meta property="article:section" content="Blog" />
|
||||
{{ with .Params.tags }}
|
||||
{{ range . }}
|
||||
<meta property="article:tag" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
{{ with .Params.image }}
|
||||
<img class="coverimage" src="{{ . }}" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue