Ver Fonte

Add OpenGraph Headers (#333)

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
Emruz Hossain há 3 anos atrás
pai
commit
4a0aa4758a
3 ficheiros alterados com 14 adições e 0 exclusões
  1. 1 0
      layouts/_default/baseof.html
  2. 1 0
      layouts/index.html
  3. 12 0
      layouts/partials/opengraph.html

+ 1 - 0
layouts/_default/baseof.html

@@ -4,6 +4,7 @@
     <title>{{ .Page.Title }}</title>
     <!------ ADD COMMON HEADERS -------->
     {{- partial "header.html" . -}}
+    {{ template "_internal/opengraph.html" . }}
 
     <!------ ADD PAGE SPECIFIC HEADERS ------->
     {{ block "header" . }} {{ end }}

+ 1 - 0
layouts/index.html

@@ -13,6 +13,7 @@
     
     <!-- import common headers -->
     {{- partial "header.html" . -}}
+    {{- partial "opengraph.html" . -}}
 
     <!-- import index page specific headers -->
     <link rel="stylesheet" href="{{ "/css/sections/home.css" | relURL }}"/>

+ 12 - 0
layouts/partials/opengraph.html

@@ -0,0 +1,12 @@
+{{ $title       :=  (index site.Data site.Language.Lang).site.openGraph.title | default site.Title }}
+{{ $type        :=  (index site.Data site.Language.Lang).site.openGraph.type | default "website" }}
+{{ $description :=  (index site.Data site.Language.Lang).site.openGraph.description | default  (index site.Data site.Language.Lang).site.description }}
+{{ $image       :=  (index site.Data site.Language.Lang).site.openGraph.image | default  (index site.Data site.Language.Lang).author.image }}
+{{ $url         :=  (index site.Data site.Language.Lang).site.openGraph.url | default site.BaseURL }}
+
+<!-- ============ open graph tags ========== -->
+<meta property="og:title" content="{{ $title }}"/>
+<meta property="og:type" content="{{ $type }}"/>
+<meta property="og:description" content="{{ $description }}"/>
+<meta property="og:image" content="{{ $image }}">
+<meta property="og:url" content="{{ $url }}">