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

Add the description meta tag to the HTML templates #6982

Merged
merged 1 commit into from
Dec 28, 2020
Merged

Conversation

jerry-sky
Copy link
Contributor

The description meta tag will make the generated HTML documents more complete and SEO-friendly.

…mplates

The `description` meta tag will make the generated HTML documents more complete and SEO-friendly.
@mb21
Copy link
Collaborator

mb21 commented Dec 26, 2020

Weird that we didn't have that already... then again, from https://moz.com/learn/seo/meta-description:

Google announced in September of 2009 that neither meta descriptions nor meta keywords factor into Google's ranking algorithms for web search.

Although sometimes it's indeed used for the text snippet displayed in Google's search results page.

@jerry-sky
Copy link
Contributor Author

jerry-sky commented Dec 26, 2020

Although sometimes it's indeed used for the text snippet displayed in Google's search results page.

Yes, that’s what I’m aiming for, and I’m aware that Google does not take those meta tags into consideration in site ranking, but from what I have found it seems that the description meta tag is in fact used when displaying the website in Google Search.

@jgm
Copy link
Owner

jgm commented Dec 26, 2020

No objections to providing a way to get descriptions in there. But this way of doing it is likely to cause problems. The descriptions metadata field will be rendered as HTML, and would need escaping to be put into an attribute, wouldn't it? What if the quotes or emphasis occur in it, for example?

This makes me think we should provide a doctemplates pipe to escape HTML; it would simplify these templates.

@jgm
Copy link
Owner

jgm commented Dec 26, 2020

In the HTML writer we'll need something like

maybe id (defField "description-meta") descriptionMeta .

(around line 325) and then (around line 257)

let descriptionMeta = stringifyHTML <$> lookupMetaInlines "description" meta

and then you'd use description-meta in the template. This will ensure that the values there are properly escaped.

@jgm
Copy link
Owner

jgm commented Dec 26, 2020

If you don't have a Haskell development environment set up, I can do that part for you.

@jerry-sky
Copy link
Contributor Author

If you don't have a Haskell development environment set up, I can do that part for you.

Yes, I would really appreciate that, because I’ve never had any experiences with Haskell development. This PR is more of a suggestion.

@jgm jgm merged commit 528b67d into jgm:master Dec 28, 2020
@jgm
Copy link
Owner

jgm commented Dec 28, 2020

OK, I'll merge this then and add something to the writer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants