Skip to content

fix canonical #1583

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

Merged
merged 2 commits into from
Oct 5, 2023
Merged

fix canonical #1583

merged 2 commits into from
Oct 5, 2023

Conversation

dimaMachina
Copy link
Contributor

No description provided.

@gatsby-cloud
Copy link

gatsby-cloud bot commented Oct 5, 2023

✅ graphql.github.io-source deploy preview ready

@dimaMachina dimaMachina marked this pull request as draft October 5, 2023 15:35
@dimaMachina dimaMachina changed the title fix canonical [wip] fix canonical Oct 5, 2023
@@ -41,6 +42,9 @@ export default function SeoConf(props: {
<meta name="twitter:title" content={twitterTitle} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />
{props.pathname && (
<link rel="canonical" href={`https://graphql.org/${props.pathname}`} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If pathname starts with a / then this will be an unpleasant URL.

Suggested change
<link rel="canonical" href={`https://graphql.org/${props.pathname}`} />
<link rel="canonical" href={`https://graphql.org/${props.pathname.replace(/^[/]+/, '')}`} />

Copy link
Contributor Author

@dimaMachina dimaMachina Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous solution didn't work, I replaced by gatsby plugin
image

@dimaMachina dimaMachina marked this pull request as ready for review October 5, 2023 19:28
@dimaMachina dimaMachina changed the title [wip] fix canonical fix canonical Oct 5, 2023
@Urigo Urigo merged commit 42cf16e into graphql:source Oct 5, 2023
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