-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pre-prod): add sitemap, move robots, other tidyup
- Loading branch information
1 parent
e7b0c7e
commit 4a714d9
Showing
10 changed files
with
80 additions
and
90 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
User-agent: * | ||
Allow: / | ||
|
||
Sitemap: https://charlesharwood.dev/sitemap.xml |
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,43 @@ | ||
import { MetadataRoute } from 'next'; | ||
|
||
import { createClient } from '@/prismic-config'; | ||
import { BASE_URL, PAGES_WITH_CUSTOM_ROUTE_HANDLERS } from '@/utils/constants'; | ||
|
||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> { | ||
const client = createClient(); | ||
const pages = await client.getAllByType('page'); | ||
|
||
const dynamicPagesMap = pages | ||
.filter((page) => !PAGES_WITH_CUSTOM_ROUTE_HANDLERS.has(page.uid)) | ||
.map( | ||
(page) => | ||
({ | ||
url: `${BASE_URL}/${page.uid}`, | ||
lastModified: new Date(page.last_publication_date), | ||
changeFrequency: 'monthly', | ||
priority: 0.5, | ||
}) as const, | ||
); | ||
|
||
return [ | ||
{ | ||
url: 'https://charlesharwood.dev', | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
priority: 1, | ||
}, | ||
{ | ||
url: 'https://charlesharwood.dev/about', | ||
lastModified: new Date(), | ||
changeFrequency: 'monthly', | ||
priority: 0.8, | ||
}, | ||
{ | ||
url: 'https://charlesharwood.dev/contact', | ||
lastModified: new Date(), | ||
changeFrequency: 'monthly', | ||
priority: 0.8, | ||
}, | ||
...dynamicPagesMap, | ||
]; | ||
} |
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
import type { Metadata } from 'next'; | ||
|
||
export const IS_DEV = process.env.NODE_ENV !== 'production'; | ||
|
||
export const BASE_URL = | ||
process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000'; | ||
|
||
export const METADATA_BASE: Metadata['metadataBase'] = new URL( | ||
`http://localhost:${process.env.PORT || 3000}`, | ||
); | ||
|
||
export const PAGES_WITH_CUSTOM_ROUTE_HANDLERS = new Set([ | ||
'home', | ||
'about', | ||
'contact', | ||
]); |