diff --git a/components/helmet.tsx b/components/helmet.tsx index e5302a340..c0dab3876 100644 --- a/components/helmet.tsx +++ b/components/helmet.tsx @@ -1,73 +1,163 @@ import NextHead from 'next/head'; import siteConfig from '../content/site.json'; +import { RoadmapType } from '../lib/roadmap'; +import { roadmapTheme } from '../styles/theme'; type HelmetProps = { title?: string; keywords?: string[]; canonical?: string; description?: string; + roadmap?: RoadmapType; }; -const Helmet = (props: HelmetProps) => ( - - +function getRichSnippetJson(roadmap: RoadmapType) { + return { + '@context': 'https://schema.org', + '@type': 'Article', + mainEntityOfPage: { + '@type': 'WebPage', + '@id': `https://roadmap.sh/${roadmap.id}`, + }, + headline: roadmap.seo.title, + description: roadmap.seo.description, + image: roadmap.jsonUrl + ? `https://roadmap.sh/roadmaps/${roadmap.id}.png` + : undefined, + author: { + '@type': 'Person', + name: 'Kamran Ahmed', + url: 'https://twitter.com/kamranahmedse', + }, + publisher: { + '@type': 'Organization', + name: 'roadmap.sh', + logo: { + '@type': 'ImageObject', + url: 'https://roadmap.sh/brand-square.png', + }, + }, + }; +} - {props.title || siteConfig.title} - +const Helmet = (props: HelmetProps) => { + const { roadmap, title, canonical, description, keywords } = props; - - + return ( + + - - {props.canonical && } - + {title || siteConfig.title} + - - - - - - - - + + - - - - - - + + {canonical && } + - - - - - - + + + + + + + + - - - - - + + + + + + - { /* Global Site Tag (gtag.js) - Google Analytics */} - {process.env.GA_SECRET && ( - <> - + )} + + {/* Global Site Tag (gtag.js) - Google Analytics */} + {process.env.GA_SECRET && ( + <> +