Skip to content

Commit

Permalink
Sc 22919/search console errors (#1398)
Browse files Browse the repository at this point in the history
* Add canonical links to header
* Removed paths from disallow
  • Loading branch information
samnixon87 authored Oct 1, 2024
1 parent f1da18a commit 33bab0d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 51 deletions.
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 =
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

0 comments on commit 33bab0d

Please sign in to comment.