revert: "fix: createContentLoader generates invalid url when sets `base`" (#2865)

This reverts commit 0f38eb4404.
pull/2876/head
Divyansh Singh 2 years ago committed by GitHub
parent 7295259f30
commit 6be5a7e830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,7 +99,8 @@ The loaded data will be an array with the type of `ContentData[]`:
```ts ```ts
interface ContentData { 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 url: string
// frontmatter data of the page // frontmatter data of the page
frontmatter: Record<string, any> frontmatter: Record<string, any>

@ -140,7 +140,7 @@ export function createContentLoader<T = ContentData[]>(
: { excerpt: renderExcerpt } : { excerpt: renderExcerpt }
) )
const url = const url =
config.site.base + '/' +
normalizePath(path.relative(config.srcDir, file)) normalizePath(path.relative(config.srcDir, file))
.replace(/(^|\/)index\.md$/, '$1') .replace(/(^|\/)index\.md$/, '$1')
.replace(/\.md$/, config.cleanUrls ? '' : '.html') .replace(/\.md$/, config.cleanUrls ? '' : '.html')

Loading…
Cancel
Save