From 6db0720d67fe777c66d1286aaef67672efed1fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Yrj=C3=B6l=C3=A4?= Date: Thu, 5 Oct 2023 13:28:02 +0300 Subject: [PATCH 1/3] Set missing metadata tags in Layout Also convert layout.js to tsx. --- components/{layout.js => layout.tsx} | 43 ++++++++++++++++------------ context/site.tsx | 1 + 2 files changed, 26 insertions(+), 18 deletions(-) rename components/{layout.js => layout.tsx} (84%) diff --git a/components/layout.js b/components/layout.tsx similarity index 84% rename from components/layout.js rename to components/layout.tsx index c99f8c83..c9b18b14 100644 --- a/components/layout.js +++ b/components/layout.tsx @@ -5,7 +5,7 @@ import Head from 'next/head'; import styled from 'styled-components'; import PlanContext from 'context/plan'; -import SiteContext from 'context/site'; +import { useSite } from 'context/site'; import EmbedContext from 'context/embed'; import ThemedGlobalStyles from 'common/ThemedGlobalStyles'; import { useTheme } from 'common/theme'; @@ -20,7 +20,7 @@ const Content = styled.main` function Layout({ children }) { const plan = useContext(PlanContext); - const site = useContext(SiteContext); + const site = useSite(); const embed = useContext(EmbedContext); const theme = useTheme(); const iconBase = theme.name @@ -45,6 +45,13 @@ function Layout({ children }) { //const displayTitle = plan.parent ? plan.parent.name : siteTitle; //const rootLink = plan.parent ? plan.parent.viewUrl : '/'; + const websiteJson = `{ + "@context" : "https://schema.org", + "@type" : "WebSite", + "name" : "${displaySite.title}", + "url" : "${site.baseURL}" + }`; + return ( <> @@ -53,7 +60,10 @@ function Layout({ children }) { {site.baseURL && ( - + <> + + + )} {iconBase && ( @@ -76,6 +86,10 @@ function Layout({ children }) { content={googleSiteVerificationTag} /> )} +