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

github.com/chipzoller/hugo-clarity.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Boothe <git@rootwork.org>2022-04-09 00:10:02 +0300
committerIvan Boothe <git@rootwork.org>2022-04-09 00:10:02 +0300
commit94ee3e2d20ee45731e58a8f5997bab22a2a51cf6 (patch)
treeedf5f84646c948b955415e8bdb51d76edaa1ba3f
parent14cc9cc7d1ac4d439b7fc9e807de36cf860e7cf9 (diff)
allow setting meta keywords from config or home page content
Signed-off-by: Ivan Boothe <git@rootwork.org>
-rw-r--r--exampleSite/config/_default/params.toml3
-rw-r--r--exampleSite/content/_index.md4
-rw-r--r--layouts/partials/opengraph.html7
3 files changed, 8 insertions, 6 deletions
diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml
index 78e41e2..d565a29 100644
--- a/exampleSite/config/_default/params.toml
+++ b/exampleSite/config/_default/params.toml
@@ -6,7 +6,8 @@ twitter = "@janedoe"
largeTwitterCard = false # set to true if you want to show a large twitter card image. The default is a small twitter card image
introDescription = "Technologist, perpetual student, teacher, continual incremental improvement."
# introURL = "about/" # set the url for the 'read more' button below the introDescription, or set to false to not show the button
-# description = "" # set your site's description here. will be use for home page content meta tags (seo). Alternatively set this description in your homepage content file i.e content/_index.md. Whatever is set in the latter will take precedence
+# description = "A theme based on VMware's Clarity Design System for publishing technical blogs with Hugo." # Set your site's meta tag (SEO) description here. Alternatively set this description in your home page content file e.g. content/_index.md. Whatever is set in the latter will take precedence.
+# keywords = ["design", "clarity", "hugo theme"] # Set your site's meta tag (SEO) keywords here. Alternatively set these in your home page content file e.g. content/_index.md. Whatever is set in the latter will take precedence.
# showShare = false # Uncomment to not show share buttons on each post. Also available in each post's front matter.
diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md
index 97ffa52..e3bb696 100644
--- a/exampleSite/content/_index.md
+++ b/exampleSite/content/_index.md
@@ -1,5 +1,5 @@
+++
author = "Hugo Authors"
-description = "A theme based on VMware's Clarity Design System for publishing technical blogs with Hugo." # set your site's description here. will be use for home page content meta tags (seo).
-keywords = ["design", "clarity","hugo theme"]
+description = "A theme based on VMware's Clarity Design System for publishing technical blogs with Hugo." # Set your site's meta tag (SEO) description here. This overrides any description set in your site configuration.
+keywords = ["design", "clarity", "hugo theme"] Set your site's meta tag (SEO) keywords here. These override any keywords set in your site configuration.
+++
diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html
index 64e747b..36557a5 100644
--- a/layouts/partials/opengraph.html
+++ b/layouts/partials/opengraph.html
@@ -41,7 +41,7 @@
{{- else }}
<meta property="og:type" content="article">
{{- end }}
-<meta name="description" content="{{ $summary }}">
+<meta name="description" content="{{ $summary }}" />
<meta name="twitter:card" content="{{ if $s.largeTwitterCard }}summary_large_image{{ else }}summary{{ end }}" />
<meta name="twitter:creator" content="{{ $s.twitter }}">
<meta name="twitter:title" content="{{ .Title }}" />
@@ -49,10 +49,11 @@
<meta property="og:title" content="{{ $title }}" />
<meta property="og:description" content="{{ $summary }}" />
<meta property="og:image" content="{{ $image }}" />
+{{- $keywords := delimit $s.keywords "," }}
{{- with $p.keywords }}
- {{- $keywords := delimit . "," }}
- <meta name="keywords" content="{{ $keywords }}">
+ {{- $keywords = delimit . "," }}
{{- end }}
+<meta name="keywords" content="{{ $keywords }}" />
{{- if eq .Section $s.blogDir -}}
{{- $date := ( .Date.Format "2006-02-01") -}}
{{- $date := (time .Date) }}