FIX: meta description tag creation in head.html (SEO)#662
Merged
LisaFC merged 1 commit intogoogle:masterfrom Aug 19, 2021
aimeeu:aimeeu-head-fix-meta-desc
Merged
FIX: meta description tag creation in head.html (SEO)#662LisaFC merged 1 commit intogoogle:masterfrom aimeeu:aimeeu-head-fix-meta-desc
LisaFC merged 1 commit intogoogle:masterfrom
aimeeu:aimeeu-head-fix-meta-desc
Conversation
Change tag creation so it add the actual page description or the first 150 characters of the page content.
Contributor
Author
|
Deploy preview: https://deploy-preview-662--docsydocs.netlify.app/docs/adding-content/feedback/#search-engine-optimization-meta-tags If you do a view source on the page, you'll see the meta description tag now contains the page's frontmatter description instead of "Docsy does docs" like in the current docsy.dev production docs site. |
Collaborator
|
Oh this is great!!! This will be really helpful for users. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
descriptiontag 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.htmladds 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
descriptiontag 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.Descriptionand 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.htmlto 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 metadescriptiontag.