diff --git a/docs/guide/data-loading.md b/docs/guide/data-loading.md index 6d54b2ca95e7..6c8cc353074a 100644 --- a/docs/guide/data-loading.md +++ b/docs/guide/data-loading.md @@ -99,7 +99,8 @@ The loaded data will be an array with the type of `ContentData[]`: ```ts interface ContentData { - // mapped absolute URL for the page. e.g. /posts/hello.html + // mapped URL for the page. e.g. /posts/hello.html (does not include base) + // manually iterate or use custom `transform` to normalize the paths url: string // frontmatter data of the page frontmatter: Record diff --git a/src/node/contentLoader.ts b/src/node/contentLoader.ts index 4aa7b8138c22..228d83a5e2f5 100644 --- a/src/node/contentLoader.ts +++ b/src/node/contentLoader.ts @@ -140,7 +140,7 @@ export function createContentLoader( : { excerpt: renderExcerpt } ) const url = - config.site.base + + '/' + normalizePath(path.relative(config.srcDir, file)) .replace(/(^|\/)index\.md$/, '$1') .replace(/\.md$/, config.cleanUrls ? '' : '.html')