Skip to content

Commit a29e16a

Browse files
authored
docs: fix content negotiation not resolving markdown (#15058)
* docs: fix content negotiation not resolving markdown * fixes * revert to config * fix llm.txt not matching sitemap * fix ci
1 parent e972cee commit a29e16a

File tree

15 files changed

+407
-185
lines changed

15 files changed

+407
-185
lines changed

.github/workflows/test-cli-with-database.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
version: 10.11.1
6363

6464
- name: Install Medusa cli
65-
run: pnpm add -g @medusajs/cli@preview
65+
run: npm i -g @medusajs/cli@preview
6666

6767
- name: Create Medusa project
6868
working-directory: ..

www/apps/bloom/middleware.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

www/apps/bloom/next.config.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,39 @@ const nextConfig = {
152152
source: "/:path*.md",
153153
destination: "/md-content/:path*",
154154
},
155+
{
156+
source: "/:path((?!md-content).+)/",
157+
has: [
158+
{
159+
type: "header",
160+
key: "Accept",
161+
value: ".*(text/markdown|text/plain).*",
162+
},
163+
],
164+
destination: "/md-content/:path",
165+
},
166+
{
167+
source: "/",
168+
has: [
169+
{
170+
type: "header",
171+
key: "Accept",
172+
value: ".*(text/markdown|text/plain).*",
173+
},
174+
],
175+
destination: "/md-content",
176+
},
177+
{
178+
source: "/:path((?!md-content).+)",
179+
has: [
180+
{
181+
type: "header",
182+
key: "Accept",
183+
value: ".*(text/markdown|text/plain).*",
184+
},
185+
],
186+
destination: "/md-content/:path",
187+
},
155188
],
156189
}
157190
},

www/apps/book/app/md-content/[[...slug]]/route.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export async function GET(req: NextRequest, { params }: Params) {
2727

2828
return new NextResponse(homepageFile + PLAINTEXT_DOC_MESSAGE, {
2929
headers: {
30-
"Content-Type": "text/markdown",
31-
"Cache-Control": "public, max-age=3600, must-revalidate",
30+
"content-type": "text/markdown",
31+
"cache-control": "public, max-age=3600, must-revalidate",
3232
},
3333
status: 200,
3434
})
@@ -97,8 +97,8 @@ export async function GET(req: NextRequest, { params }: Params) {
9797

9898
return new NextResponse(cleanMdContent + PLAINTEXT_DOC_MESSAGE, {
9999
headers: {
100-
"Content-Type": "text/markdown",
101-
"Cache-Control": "public, max-age=3600, must-revalidate",
100+
"content-type": "text/markdown",
101+
"cache-control": "public, max-age=3600, must-revalidate",
102102
},
103103
status: 200,
104104
})

www/apps/book/middleware.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

www/apps/book/next.config.mjs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,39 @@ const nextConfig = {
137137
source: "/:path((?!resources|api|ui|user-guide|cloud).*).md",
138138
destination: "/md-content/:path*",
139139
},
140-
140+
{
141+
source: "/:path((?!resources|api|ui|user-guide|cloud|md-content).+)/",
142+
has: [
143+
{
144+
type: "header",
145+
key: "Accept",
146+
value: ".*(text/markdown|text/plain).*",
147+
},
148+
],
149+
destination: "/md-content/:path",
150+
},
151+
{
152+
source: "/",
153+
has: [
154+
{
155+
type: "header",
156+
key: "Accept",
157+
value: ".*(text/markdown|text/plain).*",
158+
},
159+
],
160+
destination: "/md-content",
161+
},
162+
{
163+
source: "/:path((?!resources|api|ui|user-guide|cloud|md-content).+)",
164+
has: [
165+
{
166+
type: "header",
167+
key: "Accept",
168+
value: ".*(text/markdown|text/plain).*",
169+
},
170+
],
171+
destination: "/md-content/:path",
172+
},
141173
],
142174
fallback: [
143175
{

0 commit comments

Comments
 (0)