ADD open graph protocol support
This commit is contained in:
parent
1007588f1a
commit
9d04415667
3 changed files with 55 additions and 3 deletions
|
@ -7,10 +7,31 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}</title>
|
||||
{{ block "opengraph" . }}
|
||||
<meta property="og:type" content="website" />
|
||||
{{ 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 }}
|
||||
{{ end }}
|
||||
{{- $favIcon := .Site.Params.favIcon }}
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ if $favIcon.small }}{{ $favIcon.small }}{{ else }}/favIcon16x16.png{{ end }}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ if $favIcon.big }}{{ $favIcon.big }}{{ else }}/favIcon32x32.png{{ end }}">
|
||||
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link rel="stylesheet" type="text/css" href="/Font-Awesome/css/all.min.css">
|
||||
{{ $template := resources.Get "scss/index.scss" }}
|
||||
{{ if $template }}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{{- $header := .Site.Params.header }}
|
||||
{{- $logo := index $header "logo" }}
|
||||
{{- $links := index $header "links" }}
|
||||
{{ $template := resources.Get "scss/header.scss" }}
|
||||
{{ if $template }}
|
||||
|
@ -14,7 +13,7 @@
|
|||
<div class="progress"></div>
|
||||
<header class="header" id="header">
|
||||
<div class="header-container">
|
||||
<a class="home" href="{{ $logo.url }}"><img id="logo" class="logo" src="{{ $logo.image }}"></a>
|
||||
<a class="home" href="/#"><img id="logo" class="logo" src="{{ .Site.Params.logo }}"></a>
|
||||
<div class="header-items" id="header-items">
|
||||
{{- range $links}}
|
||||
{{ if .links }}
|
||||
|
|
|
@ -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…
Reference in a new issue