diff --git a/src/runtime/server/transformers/path-meta.ts b/src/runtime/server/transformers/path-meta.ts index 61c03f6b9..ea73f6d74 100644 --- a/src/runtime/server/transformers/path-meta.ts +++ b/src/runtime/server/transformers/path-meta.ts @@ -82,6 +82,7 @@ export function refineUrlPart (name: string): string { if (SEMVER_REGEX.test(name)) { return name } + return ( name /** @@ -91,10 +92,10 @@ export function refineUrlPart (name: string): string { /** * Remove index keyword */ - .replace(/^index/, '') + .replace(/^index(\.draft)?$/, '') /** * Remove draft keyword */ - .replace(/\.draft/, '') + .replace(/\.draft$/, '') ) } diff --git a/test/features/transformer-path-meta.ts b/test/features/transformer-path-meta.ts index 1d02e87a9..bfbd8c099 100644 --- a/test/features/transformer-path-meta.ts +++ b/test/features/transformer-path-meta.ts @@ -53,6 +53,20 @@ const testCases = { _draft: false, _partial: false, _path: '/one/fileparamvaluehash' + }, + 'content:indexer.md': { + __description: 'non-index file with index substring', + title: 'Indexer', + _draft: false, + _partial: false, + _path: '/indexer' + }, + 'content:indexer.draft.md': { + __description: 'non-index file with index substring', + title: 'Indexer', + _draft: true, + _partial: false, + _path: '/indexer' } }