Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/AmazingRise/hugo-theme-diary.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndries <andries.vanhumbeeck@outlook.com>2020-06-12 12:48:59 +0300
committerAndries <andries.vanhumbeeck@outlook.com>2020-06-12 12:48:59 +0300
commit8d025c72f4028938c26e39888bc9a67d4064a077 (patch)
tree55b227e0cb8a5ffb8bc7694a62cd4c12e96ffa26
parentef65d542411ea0b35dd6b9a723f62fa507e115dd (diff)
add opengraph
-rw-r--r--archetypes/default.md2
-rw-r--r--exampleSite/config.toml5
-rw-r--r--exampleSite/content/posts/chapter-1.md1
-rw-r--r--layouts/partials/head.html13
4 files changed, 19 insertions, 2 deletions
diff --git a/archetypes/default.md b/archetypes/default.md
index efdd08a..57de10f 100644
--- a/archetypes/default.md
+++ b/archetypes/default.md
@@ -4,6 +4,8 @@ date:
description: ""
tags: []
featured_image: ""
+images: []
categories:
comment : true
+draft: true
--- \ No newline at end of file
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index a90ec57..487f217 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -21,7 +21,10 @@ theme = "diary"
[params]
subtitle = "Themed by Diary."
enableGitalk = true
-homePageDescription = "My HomePage Description"
+description = "My HomePage Description"
+enableOpenGraph = true
+title = "My Blog" # will set 'og:title'
+description = "A collection of blogposts" # will set 'og:description'
[params.gitalk]
owner = "user"
diff --git a/exampleSite/content/posts/chapter-1.md b/exampleSite/content/posts/chapter-1.md
index c3d94b9..46cf6ef 100644
--- a/exampleSite/content/posts/chapter-1.md
+++ b/exampleSite/content/posts/chapter-1.md
@@ -2,6 +2,7 @@
date: 2017-04-09T10:58:08-04:00
description: "The Grand Hall"
featured_image: "/images/Pope-Edouard-de-Beaumont-1844.jpg"
+images: ["/images/Pope-Edouard-de-Beaumont-1844.jpg"]
tags: ["scene"]
categories: "Story"
title: "Chapter I: The Grand Hall"
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 1277fd7..baad4d7 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,14 +1,25 @@
<head>
<title>{{.Title}}</title>
+{{ $description := .Params.description}}
+{{if .IsHome}}
+ {{ $description = .Site.Params.description}}
+{{end}}
+
<meta charset="utf-8">
<meta name="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="{{ .Site.Params.googleSiteVerification }}">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta content="telephone=no" name="format-detection">
-<meta name="description" content="{{if .IsHome}}{{ .Site.Params.homePageDescription }}{{else}}{{ .Params.description }}{{end}}">
+<meta name="description" content="{{ $description }}">
<meta name="renderer" content="webkit">
<meta name="theme-color" content="#ffffff">
+
+<!-- open-graph -->
+{{if .Site.Params.enableOpenGraph}}
+{{ template "_internal/opengraph.html" . }}
+{{end}}
+
<!-- metadata -->
{{ if .Site.GoogleAnalytics }}