pagination for documents seo head meta refactor

This commit is contained in:
2021-10-22 13:23:38 +01:00
parent c388aec21f
commit 346cefd1bb
31 changed files with 1478 additions and 533 deletions
+45
View File
@@ -0,0 +1,45 @@
import React from "react";
import useTranslation from "next-translate/useTranslation";
const GlobalMetaTags = () => {
let { t } = useTranslation();
return (
<>
{console.log(t("common:service-name"))}
{/* Language by default is EN, if multilingual site this will need updated */}
<meta key="og:locale" property="og:locale" content="en" />
{/* If they have a Twitter Handle, include the meta details below */}
<meta
key="og:site_name"
property="og:site_name"
content="Planning casework "
/>
<meta
key="twitter:site"
property="twitter:site"
content="@UKGovWales"
/>
<meta
name="description"
content="The Welsh Government is the devolved Government for Wales"
/>
<meta property="og:site_name" content="GOV.WALES" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://gov.wales" />
<meta
property="og:image"
content="https://gov.wales//themes/custom/govwales/images/content/og-global-1200.png"
/>
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="gov.wales | gov.wales" />
<meta name="twitter:url" content="https://gov.wales" />
<meta
name="twitter:image"
content="https://gov.wales//themes/custom/govwales/images/content/og-global-120.png"
/>
</>
);
};
export default GlobalMetaTags;
+119
View File
@@ -0,0 +1,119 @@
import Head from "next/head";
import { string } from "prop-types";
// ALl options are conditional apart from title
const PageMeta = ({
title,
imageWidth,
imageHeight,
ogImage,
ogUrl,
ogTitle,
ogType,
ogDescription,
canonicalURL,
description,
keywords,
createdAt,
updatedAt,
robots,
twitterDescription,
twitterTitle,
twitterImage,
}) => {
const facebookPage = "https://www.facebook.com/IFPMA";
return (
<>
<Head>
{title && <title>{title}</title>}
<meta property="article:publisher" content={facebookPage} />
{createdAt && (
<meta
property="article:published_time"
content={createdAt}
/>
)}
{updatedAt && (
<meta
property="article:modified_time"
content={updatedAt}
/>
)}
{description && (
<meta
property="description"
name="description"
content={description}
/>
)}
{keywords && (
<meta
property="keywords"
name="keywords"
content={keywords}
/>
)}
<meta
property="robots"
name="robots"
content={robots || "index,follow"}
/>
{canonicalURL && <link rel="canonical" href={canonicalURL} />}
{ogUrl && <meta property="og:url" content={ogUrl} />}
{ogTitle && <meta property="og:title" content={ogTitle} />}
{ogType && <meta property="og:type" content={ogType} />}
{ogDescription && (
<meta property="og:description" content={ogDescription} />
)}
{ogImage && <meta property="og:image" content={ogImage} />}
{imageWidth && (
<meta property="og:image:width" content={imageWidth} />
)}
{imageHeight && (
<meta property="og:image:height" content={imageHeight} />
)}
<meta property="twitter:card" content="summary_large_image" />
<meta
key="twitter:site"
property="twitter:site"
content="@IFPMA"
/>
{twitterDescription && (
<meta
property="twitter:description"
content={twitterDescription}
/>
)}
{twitterTitle && (
<meta property="twitter:title" content={twitterTitle} />
)}
{twitterImage && (
<meta property="twitter:image" content={twitterImage} />
)}
</Head>
</>
);
};
PageMeta.propTypes = {
title: string,
createdAt: string,
updatedAt: string,
ogImage: string,
ogUrl: string,
ogTitle: string,
ogType: string,
ogDescription: string,
canonicalURL: string,
description: string,
keywords: string,
createdAt: string,
updatedAt: string,
robots: string,
twitterDescription: string,
twitterTitle: string,
twitterImage: string,
};
export default PageMeta;