Skip to content

Commit

Permalink
fix: broken sitemap and directs (#1047)
Browse files Browse the repository at this point in the history
Co-authored-by: viet nguyen <vietnguyen@noreply>
  • Loading branch information
vnugent and viet nguyen authored Dec 26, 2023
1 parent 13ddf4d commit 673ea55
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 158 deletions.
10 changes: 10 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ module.exports = {
},
async redirects () {
return [
{
source: '/areas/:uuid',
destination: '/area/:uuid/',
permanent: true
},
{
source: '/crag/:uuid',
destination: '/area/:uuid/',
permanent: true
},
{
source: '/blog',
destination: 'https://openbeta.substack.com/',
Expand Down
1 change: 1 addition & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Disallow: /account/
Disallow: /api/
Disallow: /auth/
Disallow: /basecamp/
Disallow: /editArea/
Sitemap: https://openbeta.io/sitemap.xml
5 changes: 4 additions & 1 deletion src/app/area/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export function generateStaticParams (): PageSlugType[] {
export async function generateMetadata ({ params }: PageWithCatchAllUuidProps): Promise<Metadata> {
const areaUuid = parseUuidAsFirstParam({ params })

const { area: { areaName, pathTokens, media } } = await getArea(areaUuid, 'cache-first')
const { area: { uuid, areaName, pathTokens, media } } = await getArea(areaUuid, 'cache-first')

let wall = ''
if (pathTokens.length >= 2) {
Expand All @@ -202,6 +202,9 @@ export async function generateMetadata ({ params }: PageWithCatchAllUuidProps):

return {
title: `${name} climbing area`,
alternates: {
canonical: `https://openbeta.io/area/${uuid}/${getFriendlySlug(areaName)}`
},
description,
openGraph: {
description,
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/recent/RecentContributionsMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type MetadataWithLatLng = ClimbType | AreaType
interface FEATURE_PROPS { historyIndex: number, name: string}
type HISTORY_FEATURE = Feature<Point, FEATURE_PROPS>

const fitBoundsOptions = { padding: 200 }
const fitBoundsOptions = { padding: 50 }

export const RecentContributionsMap: React.FC<{ history: ChangesetType[] }> = ({ history }) => {
const features = history.reduce < HISTORY_FEATURE[] >((acc, curr, index) => {
Expand Down
121 changes: 0 additions & 121 deletions src/pages/crag/[id].tsx

This file was deleted.

36 changes: 1 addition & 35 deletions src/pages/sitemap.xml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,6 @@ const query = gql`query UsaAreas( $filter: Filter) {
pathTokens
totalClimbs
density
aggregate {
byDiscipline {
sport {
total
}
trad {
total
}
boulder {
total
}
tr {
total
}
alpine {
total
}
mixed {
total
}
aid {
total
}
}
}
metadata {
lat
lng
areaId
}
media {
mediaUrl
mediaUuid
}
}
}`

Expand Down Expand Up @@ -120,7 +86,7 @@ export const getServerSideProps: GetServerSideProps = async ({ res }) => {
.map(({ uuid }) => {
return `
<url>
<loc>${baseUrl}/areas/${uuid}</loc>
<loc>${baseUrl}/area/${uuid}</loc>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
Expand Down

1 comment on commit 673ea55

@vercel
Copy link

@vercel vercel bot commented on 673ea55 Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.