From aa6f524fa6cb5b4cee0b64d35138ac0318bf7fd8 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 28 May 2022 17:13:49 +0200 Subject: Provide an ability to use `keywords` meta tag --- CHANGELOG.md | 1 + exampleSite/config.toml | 5 ++++- layouts/partials/head.html | 3 +++ layouts/partials/keywords.html | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/keywords.html diff --git a/CHANGELOG.md b/CHANGELOG.md index a5eaa3b..0e8f276 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Russian translation - Provide an ability to use hreflang attribute in raw links - Add `{{< mini-toc >}}` shortcode +- Provide an ability to use `keywords` meta tag ### Changed diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e2982d9..b19be14 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -135,6 +135,9 @@ disableKinds = ['RSS'] [params] # Site description. Used in meta description description = 'Ed is a Hugo theme designed for textual editors based on minimal computing principles, and focused on legibility and flexibility.' + # SEO keywords. Used in 'meta name="keywords"' tag. + # May be overridden by page tags. + seoKeywords = ['hugo', 'ed', 'hugo theme', 'minimal', 'responsive', 'clean'] # Copyright string. "{year}" will be replaced by © and the current year. copyright = 'Copyright © 2019-{year} John Doe' # Color scheme. Options: red, orange, magenta, cyan, blue, brown @@ -149,7 +152,7 @@ disableKinds = ['RSS'] # Order of post meta information postMeta = ['date'] # Posts date format, for example: 2006-01-02 - dateformat = 'January 02, 2006' + dateformat = ':date_long' dateFormatToc = '2006.01.02' dateFormatFeed = '2006-01-02T15:04:05Z07:00' dateFormatRFC822Z = '02 Jan 2006 15:04:05 UT' diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 24fd6f9..14cd475 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -7,6 +7,9 @@ {{ block "title" . }}{{- partial "title.html" . -}}{{ end }} + {{ if or .Params.tags site.Params.seoKeywords }} + + {{ end }} {{ hugo.Generator }} diff --git a/layouts/partials/keywords.html b/layouts/partials/keywords.html new file mode 100644 index 0000000..a25be75 --- /dev/null +++ b/layouts/partials/keywords.html @@ -0,0 +1,5 @@ +{{- if .Params.tags -}} + {{- delimit .Params.tags ", " -}} +{{- else -}}{{ site.Params.keywords }} + {{- delimit site.Params.seoKeywords ", " -}} +{{- end -}} -- cgit v1.2.3