diff options
author | Austin Gebauer <agebauer@hashicorp.com> | 2020-09-14 02:43:04 +0300 |
---|---|---|
committer | Austin Gebauer <agebauer@hashicorp.com> | 2020-09-14 02:43:04 +0300 |
commit | 268725dc5c6cbf2a26f083f34ad0291e431c42c5 (patch) | |
tree | 641ebbf6914492d562105ac59f777f1944b27484 | |
parent | 05610d758c57d0668b982d4cbf2781c28e04b589 (diff) |
adds ability to set meta descriptions for search from config file or content front matter
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/head.html | 1 |
3 files changed, 4 insertions, 0 deletions
@@ -17,6 +17,7 @@ For a live demo of the theme, see at: - Ability to use [Font Awesome](https://fontawesome.com/) icons - Ability to customize the theme styles via [Sass](https://sass-lang.com/) - Ability to customize the following items via Hugo [configuration](https://gohugo.io/getting-started/configuration/) file + - Meta description - Title - Subtitle - Image @@ -85,6 +86,7 @@ copyright = "© Copyright Year, Your Name" # Configuration Features [params] + description = "Your meta description" # Your meta description of the site header_title = "Your Name" # Your header title header_subtitle = "Your Creative Subtitle" # Your header subtitle home_image = "/images/avatar.png" # Path to header image starting from the static directory diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0e56560..95b0dae 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -31,6 +31,7 @@ copyright = "© Copyright Year, Your Name" # Configuration Features [params] + description = "Your meta description" # Your meta description of the site header_title = "Your Name" # Your header title header_subtitle = "Your Creative Subtitle" # Your header subtitle home_image = "/images/avatar.png" # Path to header image starting from the static directory diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 92b2718..41b5754 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -2,6 +2,7 @@ <title>{{ .Title }}</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <meta name="description" content="{{if .IsHome}}{{ $.Site.Params.description }}{{else}}{{.Description}}{{end}}" /> {{/* Adds complete override capability */}} {{ $overrideTemplate := resources.Get "sass/override.scss" }} |