diff options
author | MATSUKI Hidenori <mazgi@users.noreply.github.com> | 2020-01-27 18:22:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 18:22:23 +0300 |
commit | 8adec217609d50669b21bf3b2ec43337d5c9875c (patch) | |
tree | 9c2ca6fc5b79b4fcabf2acc8f647c5d4ffc08f0b | |
parent | 523d6bb632ff16b870a8f67b675a998da9193fa2 (diff) | |
parent | 2acf1f7f8aacfd70e0078b893381cf3752f32f57 (diff) |
Merge pull request #8 from mazgi/improve-page-descriptionv2020.01.0
Improve page description
-rw-r--r-- | exampleSite/archetypes/default.md | 2 | ||||
-rw-r--r-- | exampleSite/config.toml | 17 | ||||
-rw-r--r-- | exampleSite/content/about.en.md | 1 | ||||
-rw-r--r-- | exampleSite/content/about.ja.md | 1 | ||||
-rw-r--r-- | exampleSite/content/posts/2006.01/first-page.en.md | 5 | ||||
-rw-r--r-- | exampleSite/content/posts/2006.01/first-page.ja.md | 5 | ||||
-rw-r--r-- | layouts/partials/header.html | 12 |
7 files changed, 30 insertions, 13 deletions
diff --git a/exampleSite/archetypes/default.md b/exampleSite/archetypes/default.md index 00e77bd..fc920e4 100644 --- a/exampleSite/archetypes/default.md +++ b/exampleSite/archetypes/default.md @@ -1,6 +1,6 @@ --- title: "{{ replace .Name "-" " " | title }}" date: {{ .Date }} +description: "{{ title }}" draft: true --- - diff --git a/exampleSite/config.toml b/exampleSite/config.toml index c2cbf71..528bfc0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -8,10 +8,19 @@ hasCJKLanguage = true enableEmoji = true pygmentsCodeFences = true pygmentsStyle = "friendly" -enableGitInfo = true +enableGitInfo = false enableRobotsTXT = true # googleAnalytics = "UA-00000000-1" +[params] +description = "A simple Hugo theme for tech blogs :)" + +[params.sns] +github = "mazgi" +twitter = "mazgi" +instagram = "mazgi" +# facebook = "" + [taxonomies] category = "categories" tag = "tags" @@ -25,9 +34,3 @@ languageName = "English" [languages.ja] weight = 10 languageName = "日本語" - -[params.sns] -github = "mazgi" -twitter = "mazgi" -instagram = "mazgi" -# facebook = "" diff --git a/exampleSite/content/about.en.md b/exampleSite/content/about.en.md index 8f2d507..e65e4bb 100644 --- a/exampleSite/content/about.en.md +++ b/exampleSite/content/about.en.md @@ -1,6 +1,7 @@ --- title: "About" date: 2018-05-03T06:39:45+09:00 +description: "About John Doe" --- Admin: **John Doe** diff --git a/exampleSite/content/about.ja.md b/exampleSite/content/about.ja.md index 55b2c2b..703e1cb 100644 --- a/exampleSite/content/about.ja.md +++ b/exampleSite/content/about.ja.md @@ -1,6 +1,7 @@ --- title: "あばうと" date: 2018-05-03T06:39:45+09:00 +description: "じょん・どぅについて" --- 管理人: **じょん・どぅ** diff --git a/exampleSite/content/posts/2006.01/first-page.en.md b/exampleSite/content/posts/2006.01/first-page.en.md index d351aca..ea82ffe 100644 --- a/exampleSite/content/posts/2006.01/first-page.en.md +++ b/exampleSite/content/posts/2006.01/first-page.en.md @@ -1,8 +1,9 @@ --- title: "First Page" date: 2018-10-04T05:12:12Z -tags: ['hugo', 'example'] -authors: ['John', 'Jugemu Jugemu Gokoh no Surikire'] +description: "My first post" +tags: ["hugo", "example"] +authors: ["John", "Jugemu Jugemu Gokoh no Surikire"] --- ## My first post diff --git a/exampleSite/content/posts/2006.01/first-page.ja.md b/exampleSite/content/posts/2006.01/first-page.ja.md index 8c4935d..c4e0e6c 100644 --- a/exampleSite/content/posts/2006.01/first-page.ja.md +++ b/exampleSite/content/posts/2006.01/first-page.ja.md @@ -1,8 +1,9 @@ --- title: "最初のページ" date: 2018-10-04T05:12:12Z -tags: ['hugo', 'example'] -authors: ['John', 'Jugemu Jugemu Gokoh no Surikire'] +description: "私の最初のポスト" +tags: ["hugo", "example"] +authors: ["John", "Jugemu Jugemu Gokoh no Surikire"] --- ## 私の最初のポスト diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 732449c..d6e00c5 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -20,7 +20,17 @@ <meta property="og:type" content="article" /> {{ end }} <meta property="og:url" content="{{ .Permalink }}" /> - <meta property="og:description" content="{{ .Description }}" /> + {{ if .Page.IsHome }} + {{ if .Site.Params.Description }} + <meta property="og:description" content="{{ .Site.Params.Description }}" /> + {{ end }} + {{ else }} + {{ if .Description }} + <meta property="og:description" content="{{ .Description }}" /> + {{ else if .Site.Params.Description }} + <meta property="og:description" content="{{ .Site.Params.Description }}" /> + {{ end }} + {{ end }} {{ range $ext := ( slice "png" "jpg" "jpeg" ) }} {{ $ogImagePath := ( delimit ( slice $.File.Dir $.File.TranslationBaseName "/og" $ext ) "" "." ) }} {{ if ( fileExists ( print "static/" $ogImagePath ) ) }} |