From 6be5a7e830fab2361bde5a4194930b2898733a8b Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:03:35 +0530 Subject: [PATCH] revert: "fix: createContentLoader generates invalid url when sets `base`" (#2865) This reverts commit 0f38eb440492f3a486517714976fbfe6dfb30a09. --- docs/guide/data-loading.md | 3 ++- src/node/contentLoader.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/guide/data-loading.md b/docs/guide/data-loading.md index 6d54b2ca..6c8cc353 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 4aa7b813..228d83a5 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')