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

Sc 22919/search console errors #1398

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,6 @@ const DISLALLOW_LIST = [
'/docs/getting-started/adding-a-catalog-item/aws-s3/',
'/docs/getting-started/adding-a-catalog-item/azure-devops/',
'/docs/getting-started/adding-a-catalog-item/roadie-cli/',

// Referrals shouldn't be indexed
'/*?referringPathname=',

// UTM tags shouldn't be indexed
'/*?*utm_campaign=',
'/*?*utm_medium=',
'/*?*utm_content=',
'/*?*utm_source=',

// refs shouldn't be indexed.
'/*?*ref=',
];

// Only environment variables prefixed with GATSBY_ are available in the runtime. Here we turn
Expand Down
100 changes: 61 additions & 39 deletions src/components/seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,65 @@ const SEO = ({ title, description = '', lang = 'en', headerImage = '', meta = []
const metaDescription = description || site.siteMetadata.description;
const twitterHandle = get(site, 'siteMetadata.social.twitter', 'roadiehq');
const ogImageUrl = headerImage || `${site.siteMetadata.siteUrl}${roadieLogo}`;
const ogImageAlt = 'The Roadie logo. A cube in isometric projection with 3 fins cut into the right face. The word Roadie is below.';
const ogImageAlt =
'The Roadie logo. A cube in isometric projection with 3 fins cut into the right face. The word Roadie is below.';

const defaultMeta = [{
name: `description`,
content: metaDescription,
}, {
property: `og:title`,
content: title,
}, {
property: `og:description`,
content: metaDescription,
}, {
property: `og:type`,
content: `website`,
}, {
property: `og:image`,
content: ogImageUrl,
}, {
name: `twitter:card`,
content: `summary`,
}, {
name: `twitter:site`,
content: twitterHandle,
}, {
name: `twitter:image`,
content: ogImageUrl,
}, {
name: `twitter:image:alt`,
content: ogImageAlt,
}, {
name: `twitter:creator`,
content: twitterHandle,
}, {
name: `twitter:title`,
content: title,
}, {
name: `twitter:description`,
content: metaDescription,
}];
// Construct the canonical URL dynamically based on the siteUrl and current page's path
const canonicalUrl =
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this fix the pages that have multiple paths. e.g. the versioned security pages? Should we have page metadata referring to the canonical url, and then default to the current page?

typeof window !== 'undefined'
? `${site.siteMetadata.siteUrl}${window.location.pathname}`
: site.siteMetadata.siteUrl; // Fallback to siteUrl during server-side rendering

const defaultMeta = [
{
name: `description`,
content: metaDescription,
},
{
property: `og:title`,
content: title,
},
{
property: `og:description`,
content: metaDescription,
},
{
property: `og:type`,
content: `website`,
},
{
property: `og:image`,
content: ogImageUrl,
},
{
name: `twitter:card`,
content: `summary`,
},
{
name: `twitter:site`,
content: twitterHandle,
},
{
name: `twitter:image`,
content: ogImageUrl,
},
{
name: `twitter:image:alt`,
content: ogImageAlt,
},
{
name: `twitter:creator`,
content: twitterHandle,
},
{
name: `twitter:title`,
content: title,
},
{
name: `twitter:description`,
content: metaDescription,
},
];

return (
<Helmet
Expand All @@ -74,7 +94,9 @@ const SEO = ({ title, description = '', lang = 'en', headerImage = '', meta = []
}}
title={title}
meta={defaultMeta.concat(meta)}
/>
>
<link rel="canonical" href={canonicalUrl} />
</Helmet>
);
};

Expand Down
Loading