FIX: meta description tag creation in head.html (SEO) #662
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change meta
description
tag creation so the content is the actual page description or the first 150 characters of the page content rather than a value defined inconfig.toml
.Problem:
Introduced in PR #540
<meta name="description" content="{{ .Site.Params.Description }}">
inhead.html
adds the meta description tag with the exact same content to each page. According to Google's Search Engine Optimization (SEO) Starter Guide, "A page's description meta tag gives Google and other search engines a summary of what the page is about. A page's title may be a few words or a phrase, whereas a page's description meta tag might be a sentence or two or even a short paragraph." So including the exact same meta description tag on each page causes search engines and third-party search providers (like Elastic App Search) to think every page on your site has the same description. In this case, each page's description is whatever you set inconfig.toml
.For example, if you have configured:
Then every rendered page in your site will have the
<meta name="description" content="Unlocking Innovation by Making Software Delivery Continuous, Scalable, and Safe">
tag.I discovered this issue after upgrading Docsy and seeing irregularities in my SEO and Elastic indexing... and consequently poor search results. Last year I had created my meta
description
tag in my copy ofhead-end.html
. After recently upgrading Docsy, I noticed that two meta descriptions tag were created for each page: the first tag, created inhead.html
, used the.Site.Params.Description
and the second (from my customhead-end.html
) used.Page.Description
. The indexing engine picked up the first (incorrect) meta tag created inhead.html
.Fix:
change the tag creation in
head.html
to use the page's frontmatterdescription
. If there isn't a description, use the first 150 characters of the page's content. Add content to the documentation explaining how Docsy creates the metadescription
tag.