Issue Check
Hugo Version Check
Describe the Bug
The current meta description fallback order prefers .Params.Summary over .Params.Description:
{{ with (.Params.Summary | default .Params.Description) | default .Site.Params.description }}
<meta name="description" content="{{ . }}">
{{ end }}
This means that an explicitly configured description in a page's front matter is ignored whenever summary is present.
According to the Blowfish front matter documentation, description is intended for HTML metadata, while summary is intended as the article summary when summaries are shown.
Because of that, I would expect Blowfish to provide a built-in way to use description as the primary source for the HTML meta description.
I understand that changing the default fallback order could affect existing sites. However, at the moment there does not seem to be a way to use separate article summaries and SEO/meta descriptions without overriding the entire head.html partial.
To Reproduce
Create an article with both summary and description in the front matter:
---
title: "Example Article"
summary: "Short teaser text shown in article lists."
description: "SEO-oriented meta description for search engines and social previews."
---
Build the site and inspect the generated HTML head.
The generated meta description uses summary:
<meta name="description" content="Short teaser text shown in article lists.">
Expected Behaviour
There should be a supported way to make the generated meta description use description when it is explicitly set:
<meta name="description" content="SEO-oriented meta description for search engines and social previews.">
To avoid breaking existing sites, the current fallback order could remain the default. Users who want separate article summaries and SEO/meta descriptions could opt into a different order through site configuration.
Suggested fix
A backwards-compatible fix could be to make the meta description fallback order configurable.
The current behavior could remain the default:
[params.seo]
metaDescriptionOrder = ["summary", "description", "site"]
Users who want the documented description field to take precedence could opt in:
[params.seo]
metaDescriptionOrder = ["description", "summary", "site"]
The template could then resolve the first available value from that configured order.
For example:
{{ $metaDescriptionOrder := .Site.Params.seo.metaDescriptionOrder | default (slice "summary" "description" "site") }}
{{ $metaDescriptionSources := dict
"summary" .Params.Summary
"description" .Params.Description
"site" .Site.Params.description
}}
{{ $metaDescription := "" }}
{{ range $metaDescriptionOrder }}
{{ $metaDescription = $metaDescription | default (index $metaDescriptionSources (lower .)) }}
{{ end }}
{{ with $metaDescription }}
<meta name="description" content="{{ . | plainify }}">
{{ end }}
This would avoid breaking existing sites while making it possible to use separate article summaries and SEO/meta descriptions without overriding the full head.html partial.
Using plainify would also avoid raw Markdown being emitted into the meta description when the fallback value comes from summary.
Screenshots
No response
Platform
- OS: Linux
- Browser: firefox
- Version: 150
Hugo Version
hugo v0.160.1+extended+withdeploy linux/amd64
Blowfish Version
Additional Context
This is related to #690, where the current behavior and the backwards compatibility concern were discussed before.
The suggestion above keeps the current behavior as the default, but adds an opt-in path for users who want description to take precedence over summary.
This would solve the issue without forcing existing sites to change their generated meta descriptions.
Code of Conduct
Issue Check
Hugo Version Check
Describe the Bug
The current meta description fallback order prefers
.Params.Summaryover.Params.Description:This means that an explicitly configured
descriptionin a page's front matter is ignored wheneversummaryis present.According to the Blowfish front matter documentation,
descriptionis intended for HTML metadata, whilesummaryis intended as the article summary when summaries are shown.Because of that, I would expect Blowfish to provide a built-in way to use
descriptionas the primary source for the HTML meta description.I understand that changing the default fallback order could affect existing sites. However, at the moment there does not seem to be a way to use separate article summaries and SEO/meta descriptions without overriding the entire
head.htmlpartial.To Reproduce
Create an article with both
summaryanddescriptionin the front matter:Build the site and inspect the generated HTML head.
The generated meta description uses
summary:Expected Behaviour
There should be a supported way to make the generated meta description use
descriptionwhen it is explicitly set:To avoid breaking existing sites, the current fallback order could remain the default. Users who want separate article summaries and SEO/meta descriptions could opt into a different order through site configuration.
Suggested fix
A backwards-compatible fix could be to make the meta description fallback order configurable.
The current behavior could remain the default:
Users who want the documented
descriptionfield to take precedence could opt in:The template could then resolve the first available value from that configured order.
For example:
This would avoid breaking existing sites while making it possible to use separate article summaries and SEO/meta descriptions without overriding the full
head.htmlpartial.Using
plainifywould also avoid raw Markdown being emitted into the meta description when the fallback value comes fromsummary.Screenshots
No response
Platform
Hugo Version
hugo v0.160.1+extended+withdeploy linux/amd64Blowfish Version
v2.102.0Additional Context
This is related to #690, where the current behavior and the backwards compatibility concern were discussed before.
The suggestion above keeps the current behavior as the default, but adds an opt-in path for users who want
descriptionto take precedence oversummary.This would solve the issue without forcing existing sites to change their generated meta descriptions.
Code of Conduct