From ef65d542411ea0b35dd6b9a723f62fa507e115dd Mon Sep 17 00:00:00 2001 From: Andries Date: Fri, 12 Jun 2020 10:58:45 +0200 Subject: [PATCH 1/6] add homepage description --- exampleSite/config.toml | 1 + layouts/partials/head.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a95e7c39..a90ec572 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -21,6 +21,7 @@ theme = "diary" [params] subtitle = "Themed by Diary." enableGitalk = true +homePageDescription = "My HomePage Description" [params.gitalk] owner = "user" diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 588d07ea..1277fd7e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -6,7 +6,7 @@ - + From 8d025c72f4028938c26e39888bc9a67d4064a077 Mon Sep 17 00:00:00 2001 From: Andries Date: Fri, 12 Jun 2020 11:48:59 +0200 Subject: [PATCH 2/6] add opengraph --- archetypes/default.md | 2 ++ exampleSite/config.toml | 5 ++++- exampleSite/content/posts/chapter-1.md | 1 + layouts/partials/head.html | 13 ++++++++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/archetypes/default.md b/archetypes/default.md index efdd08a0..57de10f3 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 a90ec572..487f2177 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 c3d94b92..46cf6ef4 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 1277fd7e..baad4d73 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,14 +1,25 @@ {{.Title}} +{{ $description := .Params.description}} +{{if .IsHome}} + {{ $description = .Site.Params.description}} +{{end}} + - + + + +{{if .Site.Params.enableOpenGraph}} +{{ template "_internal/opengraph.html" . }} +{{end}} + {{ if .Site.GoogleAnalytics }} From d28dc8d1725b6b7dde11b6831fd52b771108dcd9 Mon Sep 17 00:00:00 2001 From: Andries Date: Fri, 12 Jun 2020 11:56:01 +0200 Subject: [PATCH 3/6] enable twitter cards --- exampleSite/config.toml | 6 +++--- layouts/partials/head.html | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 487f2177..36023684 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -21,10 +21,10 @@ theme = "diary" [params] subtitle = "Themed by Diary." enableGitalk = true -description = "My HomePage Description" enableOpenGraph = true -title = "My Blog" # will set 'og:title' -description = "A collection of blogposts" # will set 'og:description' +enableTwitterCards = true +title = "My Blog" # will set 'og:site_name' +description = "My HomePage Description" # will set 'og:description' [params.gitalk] owner = "user" diff --git a/layouts/partials/head.html b/layouts/partials/head.html index baad4d73..a43b9b7b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -20,6 +20,11 @@ {{ template "_internal/opengraph.html" . }} {{end}} + +{{if .Site.Params.enableTwitterCards}} +{{ template "_internal/twitter_cards.html" . }} +{{end}} + {{ if .Site.GoogleAnalytics }} From b257cfbd8d28d347f8cb29250f2d68b1628319e1 Mon Sep 17 00:00:00 2001 From: Andries Date: Fri, 12 Jun 2020 12:07:16 +0200 Subject: [PATCH 4/6] add optional manifest file --- layouts/partials/head.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a43b9b7b..daf88de4 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -38,6 +38,10 @@ +{{if .Site.Params.manifest}} + +{{end}} + {{ if .Site.Params.favicon }} From 29bc19c3496272e07521c9af96d836b8898715e2 Mon Sep 17 00:00:00 2001 From: Rise <8315221+AmazingRise@users.noreply.github.com> Date: Sun, 14 Jun 2020 17:18:09 +0800 Subject: [PATCH 5/6] Add a comment to `images` --- archetypes/default.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archetypes/default.md b/archetypes/default.md index 57de10f3..f8184fe4 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -4,8 +4,9 @@ date: description: "" tags: [] featured_image: "" +# images is optional, but needed for showing Twitter Card images: [] categories: comment : true draft: true ---- \ No newline at end of file +--- From d24fbc4b5f2a081fbf3f493fd4082dd431e400cb Mon Sep 17 00:00:00 2001 From: Rise <8315221+AmazingRise@users.noreply.github.com> Date: Sun, 14 Jun 2020 17:19:22 +0800 Subject: [PATCH 6/6] Add a comment for config.toml --- exampleSite/config.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 36023684..7291d444 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -21,6 +21,8 @@ theme = "diary" [params] subtitle = "Themed by Diary." enableGitalk = true + +# Twitter Card and Open Graph settings enableOpenGraph = true enableTwitterCards = true title = "My Blog" # will set 'og:site_name'