Skip to content

Commit

Permalink
πŸ” Added unique meta description for home page (#1621)
Browse files Browse the repository at this point in the history
* πŸ” Added unique meta description for home page

* πŸ› Updated regex pattern to match site url absolutely

* 🚨 updated prop types for layout page

---------

Co-authored-by: Calinator444 <caleb.williams5247@gmail.com>
  • Loading branch information
Calinator444 and Calinator444 authored Nov 6, 2024
1 parent f953cdb commit a8b4faf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions site-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
siteTitle: `SSW.Rules`,
siteTitleShort: `SSW.Rules`,
siteDescription: `Secret Ingredients to Quality Software | SSW Rules provides best practices for developing secure, reliable, and efficient .NET, Azure, CRM, Angular, React, Dynamics, and AI applications. Learn more today!`,
homePageDescription: `Explore SSW Rules – a trusted library of best practices for software development and project management designed to foster growth and boost productivity!`,
siteUrl: `https://www.ssw.com.au/rules`,
// Relative URL to website home
siteUrlRelative: `/`,
Expand Down
28 changes: 20 additions & 8 deletions src/components/layout/layout.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import React, { useRef, useState } from 'react';
import { Auth0Provider } from '@auth0/auth0-react';
import { config } from '@fortawesome/fontawesome-svg-core';
import '@fortawesome/fontawesome-svg-core/styles.css';
import { graphql, navigate, useStaticQuery } from 'gatsby';
import PropTypes from 'prop-types';
import { useStaticQuery, graphql, navigate } from 'gatsby';
import React, { useRef, useState } from 'react';
import '../../style.css';
import Footer from '../footer/footer';
import Head from '../head/head';
import Header from '../header/header';
import Footer from '../footer/footer';
import '../../style.css';
import { config } from '@fortawesome/fontawesome-svg-core';
import { Auth0Provider } from '@auth0/auth0-react';
import '@fortawesome/fontawesome-svg-core/styles.css';

config.autoAddCss = false;
const Layout = ({
data,
children,
displayActions,
ruleUri,
crumbLabel,
seoDescription,
location,
}) => {
const isHomePage =
location?.href &&
location?.href.match(/^https:\/\/www\.ssw\.com\.au\/rules\/{0,1}$/);
const description = isHomePage
? data?.site?.siteMetadata.homePageDescription
: seoDescription;
const node = useRef();
const [isMenuOpened, setIsMenuOpened] = useState(false);

Expand Down Expand Up @@ -54,7 +62,7 @@ const Layout = ({
}}
>
<div className="flex flex-col min-h-screen main-container">
<Head pageTitle={crumbLabel} seoDescription={seoDescription} />
<Head pageTitle={crumbLabel} seoDescription={description} />
<Header displayActions={displayActions} ruleUri={ruleUri} />
<main className="flex-1">{children}</main>
</div>
Expand All @@ -74,6 +82,9 @@ Layout.propTypes = {
crumbLocation: PropTypes.object,
crumbLabel: PropTypes.string,
seoDescription: PropTypes.string,
location: {
href: PropTypes.string,
},
};

function LayoutWithQuery(props) {
Expand All @@ -82,6 +93,7 @@ function LayoutWithQuery(props) {
site {
siteMetadata {
siteTitle
homePageDescription
}
}
}
Expand Down

0 comments on commit a8b4faf

Please sign in to comment.