Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: meta description tag creation in head.html (SEO) #662

Merged
merged 1 commit into from
Aug 19, 2021
Merged

FIX: meta description tag creation in head.html (SEO) #662

merged 1 commit into from
Aug 19, 2021

Conversation

aimeeu
Copy link
Contributor

@aimeeu aimeeu commented Aug 18, 2021

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 in config.toml.

Problem:
Introduced in PR #540
<meta name="description" content="{{ .Site.Params.Description }}"> in head.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 in config.toml.

For example, if you have configured:

[languages.en]
title = "Armory Docs"
description = "Unlocking Innovation by Making Software Delivery Continuous, Scalable, and Safe "

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 of head-end.html. After recently upgrading Docsy, I noticed that two meta descriptions tag were created for each page: the first tag, created in head.html, used the .Site.Params.Description and the second (from my custom head-end.html) used .Page.Description. The indexing engine picked up the first (incorrect) meta tag created in head.html.

Fix:
change the tag creation in head.html to use the page's frontmatter description. 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 meta description tag.

Change tag creation so it add the actual page description
or the first 150 characters of the page content.
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Aug 18, 2021
@aimeeu
Copy link
Contributor Author

aimeeu commented Aug 18, 2021

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.

@LisaFC
Copy link
Collaborator

LisaFC commented Aug 19, 2021

Oh this is great!!! This will be really helpful for users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants