diff options
author | Hidenori MATSUKI <MATSUKI.Hidenori@gmail.com> | 2020-01-27 17:23:25 +0300 |
---|---|---|
committer | Hidenori MATSUKI <MATSUKI.Hidenori@gmail.com> | 2020-01-27 17:54:21 +0300 |
commit | fac30f177bef03e89f94bfc4bd5e8b1e2f5ee5d2 (patch) | |
tree | 00b0c99972e50b8a11688ce3de14825d28786710 | |
parent | 523d6bb632ff16b870a8f67b675a998da9193fa2 (diff) |
improve page description
-rw-r--r-- | exampleSite/archetypes/default.md | 2 | ||||
-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 |
6 files changed, 20 insertions, 6 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/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 ) ) }} |