-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
refactor(www): Create PageMetadata component #21815
Conversation
Abstract over the raw <Helmet> component to consolidate common descriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can possibly change some stuff around and add in missing properties that should be here.
Another important omission is the og:img:alt
tag:
og:image:alt
- A description of what is in the image (not a caption). If the page specifies an og:image it should specifyog:image:alt
.
The blog pages have an imageTitle
in their frontmatter but I'm not sure what's the proper tag for other docs. We can also table it for a different PR.
description={post.fields.excerpt} | ||
image={post.frontmatter.image.childImageSharp.resize} | ||
> | ||
<meta property="og:url" content={href} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Fix #21563 in this PR and get rid of this.
<Helmet> | ||
<title>{`${creator.name} - Creator`}</title> | ||
</Helmet> | ||
<PageMetadata title={`${creator.name} - Creator`} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could possibly add a description
and image
to this page if we'd like.
title={`${repoName}: Gatsby Starter`} | ||
image={screenshot.childImageSharp.fluid} | ||
description={`Gatsby Starters: ${repoName}`} | ||
timeToRead={1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the hardcoded "timeToRead" labels in pages like this useful? We may as well get rid of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually... I'm trying to find information on reading time
but I can't seem to find anything. Was this a feature that was taken out at some point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found information on twitter:label1
only on third-party sites and it seems like it's been removed from the official twitter developer docs. Playing around with the validator doesn't show our time to read in any of our docs.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for your first question: I wouldn't say they are useful for starters and would switch the information for something like e.g. author or GitHub link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well that's not intuitive at all. I'm adding a comment :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think switching the information is a good idea, but I'll leave that for a separate PR for now.
|
@muescha According to the Twitter documentation:
So we don't actually need these Twitter descriptions to generate a card (I think). You can verify this behavior by testing the build above with the Twitter card validator. |
is this still the current build with all new commits? |
www/src/components/layout.js
Outdated
@@ -20,7 +20,7 @@ export default function DefaultLayout({ location, locale, children }) { | |||
return ( | |||
<LocaleContext.Provider value={locale || defaultLang}> | |||
<Global styles={globalStyles} /> | |||
<SiteMetadata pathname={location.pathname} locale={locale} /> | |||
<SiteMetadata href={location.href} locale={locale} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when the link build-5fdd9a37-e2ae-4a55-a681-3bea24c30edb.gtsb.io is the current link to the build system,
then location.href
is not available at SSR:
Check:
curl https://build-5fdd9a37-e2ae-4a55-a681-3bea24c30edb.gtsb.io/showcase/reactjs.org | grep "canonical" | less
results in:
<link data-react-helmet="true" rel="canonical"/>
<meta data-react-helmet="true" name="docsearch:version" content="2.0"/>
<meta data-react-helmet="true" name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no,viewport-fit=cover"/>
<meta data-react-helmet="true" property="og:url"/>
while
curl https://www.gatsbyjs.org/showcase/reactjs.org | grep "canonical" | less
<link data-react-helmet="true" rel="canonical" href="https://www.gatsbyjs.org/showcase/reactjs.org"/>
<meta data-react-helmet="true" name="docsearch:version" content="2.0"/>
<meta data-react-helmet="true" name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no,viewport-fit=cover"/>
<meta data-react-helmet="true" property="og:url" content="https://www.gatsbyjs.org"/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip! I'll change it back to using pathname. I didn't know that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but check it before with a current build
i remember there was that problem, but unfortunly i can not find some issues or some docs (troubleshooting) about this ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added issue:
docs: add info about location.href
thanks for the link to the blog post in code comments :)
d9594ae
to
9502a5a
Compare
# Conflicts: # www/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's so much going on in the head of these pages, I wasn't immediately sure that everything was where it needed to be but it's looking solid!
Thanks for this (especially the tests), @tesseralis! |
Description
Create an abstraction over the raw
<Helmet>
component to consolidate common metadata.TODO:
Add more/standardize more descriptions and informationMotivation
Build
https://build-5fdd9a37-e2ae-4a55-a681-3bea24c30edb.gtsb.io/
Related Issues
fixes: #21562