-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/seo improvements INTER-306 (#92)
* feat: add HSTS header * feat: add sitemap * feat: use fingerprinthub for sitemap for now * feat: add seo component * feat: rename to seo component * chore: fix meta url * chore: improve card accessibility * chore: add use case seo
- Loading branch information
Showing
9 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Head from 'next/head'; | ||
import { FunctionComponent } from 'react'; | ||
import { PRODUCTION_URL } from './content'; | ||
|
||
type HeadSEOProps = { | ||
title: string; | ||
description: string; | ||
image?: string; | ||
path?: string; | ||
}; | ||
|
||
export const SEO: FunctionComponent<HeadSEOProps> = ({ title, description, image, path }) => { | ||
const metaImage = image ?? `${PRODUCTION_URL}/fingerprintDefaultMetaImage.png`; | ||
const metaUrl = `${PRODUCTION_URL}${path ?? ''}`; | ||
return ( | ||
<Head> | ||
<title>{title}</title> | ||
<meta name="description" content={description} /> | ||
<meta name="image" content={metaImage} /> | ||
|
||
<meta property="og:type" content="website" /> | ||
<meta property="og:title" content={title} /> | ||
<meta property="og:description" content={description} /> | ||
<meta property="og:site_name" content="Fingerprint Use Cases" /> | ||
<meta property="og:image" content={metaImage} /> | ||
<meta property="og:url" content={metaUrl} /> | ||
|
||
<meta name="twitter:title" content={title} /> | ||
<meta name="twitter:description" content={description} /> | ||
<meta name="twitter:card" content="summary_large_image" /> | ||
<meta name="twitter:image" content={metaImage} /> | ||
<meta name="twitter:url" content={metaUrl} /> | ||
</Head> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { HOMEPAGE_CARDS, PRODUCTION_URL } from '../client/components/common/content'; | ||
|
||
function generateSiteMap() { | ||
return `<?xml version="1.0" encoding="UTF-8"?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
<url> | ||
<loc>${PRODUCTION_URL}</loc> | ||
</url> | ||
${HOMEPAGE_CARDS.map(({ url }) => { | ||
return ` | ||
<url> | ||
<loc>${`${PRODUCTION_URL}${url}`}</loc> | ||
</url> | ||
`; | ||
}).join('')} | ||
</urlset> | ||
`; | ||
} | ||
|
||
function SiteMap() { | ||
// getServerSideProps will do the heavy lifting | ||
} | ||
|
||
export async function getServerSideProps({ res }) { | ||
const sitemap = generateSiteMap(); | ||
|
||
res.setHeader('Content-Type', 'text/xml'); | ||
// we send the XML to the browser | ||
res.write(sitemap); | ||
res.end(); | ||
|
||
return { | ||
props: {}, | ||
}; | ||
} | ||
|
||
export default SiteMap; |