-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnext.config.ts
More file actions
84 lines (80 loc) · 2.61 KB
/
Copy pathnext.config.ts
File metadata and controls
84 lines (80 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import type { NextConfig } from "next"
import { components } from "./data/components-simple"
/**
* Retirement redirects — added 2026-07-30.
*
* The cheatsheet has been rebuilt inside the ShadcnStore docs, rewritten for
* the current shadcn (Base UI) instead of the Radix-era content here, at
* shadcnstore.com/docs/components/*. Keeping two competing sets of component
* pages on two hosts splits the ranking signals between them, so this app now
* exists only to hand its URLs to their replacements.
*
* Every component id below has a verified page at /docs/components/<id> — all
* 53 ids in data/components-simple.ts map 1:1, checked against the live docs
* sitemap before this was written. Variants (/component/button/link) fold into
* the base component page, which documents every variant in one place.
*
* Deliberately NOT redirected:
* - /sitemap.xml and /robots.txt, so crawlers can keep fetching the URL list
* and discover these redirects. They are the mechanism that retires the
* subdomain; remove them only once the pages have de-indexed.
* - /api/*, which serves the component registry.
*/
const DOCS = "https://shadcnstore.com/docs"
const componentRedirects = components.flatMap((component) => [
{
source: `/component/${component.id}`,
destination: `${DOCS}/components/${component.id}`,
statusCode: 301,
},
{
// Every variant page beneath a component lands on that component's page.
source: `/component/${component.id}/:variant*`,
destination: `${DOCS}/components/${component.id}`,
statusCode: 301,
},
])
const nextConfig: NextConfig = {
/* config options here */
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'avatar.vercel.sh',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
},
],
},
async redirects() {
return [
{
source: "/",
destination: `${DOCS}/cheatsheet`,
statusCode: 301,
},
...componentRedirects,
{
source: "/theming",
destination: `${DOCS}/theming`,
statusCode: 301,
},
// Anything left under these prefixes — retired ids, deep links we no
// longer publish, crawler noise — goes to the components hub rather than
// a 404. Listed after the specific rules, which win on first match.
{
source: "/component/:path*",
destination: `${DOCS}/components/`,
statusCode: 301,
},
{
source: "/components/:path*",
destination: `${DOCS}/components/`,
statusCode: 301,
},
]
},
}
export default nextConfig