File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,13 @@ describe("filenameToPath", () => {
6363
6464 test ( "changelog" , ( ) => {
6565 expect (
66- filenameToPath ( "src/content/changelogs-next /2025-02-05-title.mdx" ) ,
66+ filenameToPath ( "src/content/changelog/workers /2025-02-05-title.mdx" ) ,
6767 ) . toEqual ( "changelog/2025-02-05-title/" ) ;
6868 } ) ;
6969
7070 test ( "changelog base" , ( ) => {
7171 expect (
72- `${ DOCS_BASE_URL } /${ filenameToPath ( "src/content/changelogs-next /2025-02-05-title.mdx" ) } ` ,
72+ `${ DOCS_BASE_URL } /${ filenameToPath ( "src/content/changelog/workers /2025-02-05-title.mdx" ) } ` ,
7373 ) . toEqual ( "https://developers.cloudflare.com/changelog/2025-02-05-title/" ) ;
7474 } ) ;
7575} ) ;
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ async function run(): Promise<void> {
7777 ( file ) =>
7878 file . filename . endsWith ( ".mdx" ) &&
7979 ( file . filename . startsWith ( `${ CONTENT_BASE_PATH } /docs/` ) ||
80- file . filename . startsWith ( `${ CONTENT_BASE_PATH } /changelogs-next /` ) ) ,
80+ file . filename . startsWith ( `${ CONTENT_BASE_PATH } /changelog /` ) ) ,
8181 )
8282 . sort ( ( a , b ) => b . changes - a . changes )
8383 . slice ( 0 , 15 ) // Limit to 15 entries
Original file line number Diff line number Diff line change @@ -3,20 +3,24 @@ import { execSync } from "node:child_process";
33import { CONTENT_BASE_PATH } from "./constants" ;
44
55export const filenameToPath = ( filename : string ) => {
6- return filename
6+ let segments = filename
77 . replace ( CONTENT_BASE_PATH , "" )
88 . replace ( ".mdx" , "" )
99 . split ( "/" )
10- . filter ( Boolean )
10+ . filter ( Boolean ) ;
11+
12+ const changelogIdx = segments . findIndex ( ( s ) => s === "changelog" ) ;
13+
14+ if ( changelogIdx !== - 1 ) {
15+ segments . splice ( changelogIdx + 1 , 1 ) ;
16+ }
17+
18+ return segments
1119 . flatMap ( ( segment ) => {
1220 if ( segment === "docs" ) {
1321 return [ ] ;
1422 }
1523
16- if ( segment === "changelogs-next" ) {
17- segment = "changelog" ;
18- }
19-
2024 const slugified = slug ( segment ) ;
2125
2226 if ( slugified === "1111" ) {
You can’t perform that action at this time.
0 commit comments