diff options
author | Rise <8315221+AmazingRise@users.noreply.github.com> | 2020-06-14 12:30:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-14 12:30:36 +0300 |
commit | f2859ea1dbcb78c50168c9665b27f172453c4566 (patch) | |
tree | 00d66eca558e007ef0c017c92e7889118b6438b3 | |
parent | 7980b976cfc62ab3ed1c852c47ea00b112f01b63 (diff) | |
parent | d24fbc4b5f2a081fbf3f493fd4082dd431e400cb (diff) |
Merge pull request #52 from vanhumbeecka/master
Add OpenGraph and TwitterCard metadata
-rw-r--r-- | archetypes/default.md | 5 | ||||
-rw-r--r-- | exampleSite/config.toml | 6 | ||||
-rw-r--r-- | exampleSite/content/posts/chapter-1.md | 1 | ||||
-rw-r--r-- | layouts/partials/head.html | 22 |
4 files changed, 32 insertions, 2 deletions
diff --git a/archetypes/default.md b/archetypes/default.md index efdd08a..f8184fe 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -4,6 +4,9 @@ date: description: "" tags: [] featured_image: "" +# images is optional, but needed for showing Twitter Card +images: [] categories: comment : true ----
\ No newline at end of file +draft: true +--- diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a95e7c3..7291d44 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -22,6 +22,12 @@ theme = "diary" subtitle = "Themed by Diary." enableGitalk = true +# Twitter Card and Open Graph settings +enableOpenGraph = true +enableTwitterCards = true +title = "My Blog" # will set 'og:site_name' +description = "My HomePage Description" # will set 'og:description' + [params.gitalk] owner = "user" repo = "repo name" 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 588d07e..daf88de 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,14 +1,30 @@ <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="{{ .Params.description }}"> +<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}} + +<!-- twitter-cards --> +{{if .Site.Params.enableTwitterCards}} +{{ template "_internal/twitter_cards.html" . }} +{{end}} + <!-- metadata --> {{ if .Site.GoogleAnalytics }} @@ -22,6 +38,10 @@ <link type="text/css" rel="stylesheet" href="{{"/vendor/css/bootstrap.min.css" | relURL}}"> <script src="{{"/vendor/js/vue.min.js" | relURL}}" ></script> +{{if .Site.Params.manifest}} +<link rel="manifest" href="{{.Site.Params.manifest}}"> +{{end}} + {{ if .Site.Params.favicon }} <link rel="icon" href="{{ .Site.Params.favicon }}"> <!-- favicon --> |