Skip to content

Commit 6b0befe

Browse files
committed
fix(landing): return 404 for unknown library, blog, integration, model, and author slugs
1 parent d05ae7a commit 6b0befe

8 files changed

Lines changed: 55 additions & 14 deletions

File tree

‎apps/docs/app/sitemap.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ import { DOCS_BASE_URL } from '@/lib/urls'
55
export const revalidate = 3600
66

77
export default function sitemap(): MetadataRoute.Sitemap {
8-
return source.getPages().map((page) => ({
9-
url: `${DOCS_BASE_URL}${page.url}`,
10-
lastModified: 'lastModified' in page.data ? page.data.lastModified : undefined,
11-
}))
8+
// The docs root redirects to /introduction, which is listed on its own.
9+
return source
10+
.getPages()
11+
.filter((page) => page.url !== '/')
12+
.map((page) => ({
13+
url: `${DOCS_BASE_URL}${page.url}`,
14+
lastModified: 'lastModified' in page.data ? page.data.lastModified : undefined,
15+
}))
1216
}

‎apps/sim/app/(landing)/blog/[slug]/page.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import { getAllPostMeta, getPostBySlug, getRelatedPosts } from '@/lib/blog/regis
44
import { BLOG_SECTION, buildPostGraphJsonLd, buildPostMetadata } from '@/lib/blog/seo'
55
import { ContentPostPage } from '@/app/(landing)/components'
66

7-
/** Unknown slugs reach the section 404 while known pages remain pre-rendered. */
8-
export const dynamicParams = true
7+
/**
8+
* Unknown params must 404 before rendering: `notFound()` during render streams this segment's
9+
* `loading.tsx` with a 200 status first.
10+
*/
11+
export const dynamicParams = false
912

1013
export async function generateStaticParams() {
1114
const posts = await getAllPostMeta()

‎apps/sim/app/(landing)/blog/authors/[id]/page.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ import { ContentAuthorPage } from '@/app/(landing)/components'
66

77
export const revalidate = 3600
88

9+
/**
10+
* Unknown params must 404 before rendering: `notFound()` during render streams this segment's
11+
* `loading.tsx` with a 200 status first.
12+
*/
13+
export const dynamicParams = false
14+
15+
export async function generateStaticParams() {
16+
const ids = new Set((await getAllPostMeta()).flatMap((p) => p.authors.map((a) => a.id)))
17+
return [...ids].map((id) => ({ id }))
18+
}
19+
920
export async function generateMetadata({
1021
params,
1122
}: {

‎apps/sim/app/(landing)/integrations/(shell)/[slug]/page.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ const MAX_TEMPLATES_SHOWN = 12
4747
const bySlug = new Map(allIntegrations.map((i) => [i.slug, i]))
4848
const byType = new Map(allIntegrations.map((i) => [i.type, i]))
4949

50-
/** Unknown slugs reach the section 404 while known pages remain pre-rendered. */
51-
export const dynamicParams = true
50+
/**
51+
* Unknown params must 404 before rendering: `notFound()` during render streams this segment's
52+
* `loading.tsx` with a 200 status first.
53+
*/
54+
export const dynamicParams = false
5255

5356
/**
5457
* Returns up to `limit` related integration slugs from the same category, so

‎apps/sim/app/(landing)/library/[slug]/page.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ import { ComparisonLinks } from '@/app/(landing)/comparisons/components/comparis
66
import { getComparisonsForPost } from '@/app/(landing)/comparisons/library-links'
77
import { ContentPostPage } from '@/app/(landing)/components'
88

9-
/** Unknown slugs reach the section 404 while known pages remain pre-rendered. */
10-
export const dynamicParams = true
9+
/**
10+
* Unknown params must 404 before rendering: `notFound()` during render streams this segment's
11+
* `loading.tsx` with a 200 status first.
12+
*/
13+
export const dynamicParams = false
1114

1215
export async function generateStaticParams() {
1316
const posts = await getAllPostMeta()

‎apps/sim/app/(landing)/library/authors/[id]/page.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ import { ContentAuthorPage } from '@/app/(landing)/components'
66

77
export const revalidate = 3600
88

9+
/**
10+
* Unknown params must 404 before rendering: `notFound()` during render streams this segment's
11+
* `loading.tsx` with a 200 status first.
12+
*/
13+
export const dynamicParams = false
14+
15+
export async function generateStaticParams() {
16+
const ids = new Set((await getAllPostMeta()).flatMap((p) => p.authors.map((a) => a.id)))
17+
return [...ids].map((id) => ({ id }))
18+
}
19+
920
export async function generateMetadata({
1021
params,
1122
}: {

‎apps/sim/app/(landing)/models/(shell)/[provider]/[model]/page.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ import {
2525

2626
const baseUrl = SITE_URL
2727

28-
/** Unknown slugs reach the section 404 while known pages remain pre-rendered. */
29-
export const dynamicParams = true
28+
/**
29+
* Unknown params must 404 before rendering: `notFound()` during render streams this segment's
30+
* `loading.tsx` with a 200 status first.
31+
*/
32+
export const dynamicParams = false
3033

3134
export async function generateStaticParams() {
3235
return ALL_CATALOG_MODELS.map((model) => ({

‎apps/sim/app/(landing)/models/(shell)/[provider]/page.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ import {
2424

2525
const baseUrl = SITE_URL
2626

27-
/** Unknown slugs reach the section 404 while known pages remain pre-rendered. */
28-
export const dynamicParams = true
27+
/**
28+
* Unknown params must 404 before rendering: `notFound()` during render streams this segment's
29+
* `loading.tsx` with a 200 status first.
30+
*/
31+
export const dynamicParams = false
2932

3033
export async function generateStaticParams() {
3134
return MODEL_PROVIDERS_WITH_CATALOGS.map((provider) => ({

0 commit comments

Comments
 (0)