Skip to content

Commit 6be5a7e

Browse files
authoredAug 28, 2023
revert: "fix: createContentLoader generates invalid url when sets base" (#2865)
This reverts commit 0f38eb4.
1 parent 7295259 commit 6be5a7e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎docs/guide/data-loading.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ The loaded data will be an array with the type of `ContentData[]`:
9999

100100
```ts
101101
interface ContentData {
102-
// mapped absolute URL for the page. e.g. /posts/hello.html
102+
// mapped URL for the page. e.g. /posts/hello.html (does not include base)
103+
// manually iterate or use custom `transform` to normalize the paths
103104
url: string
104105
// frontmatter data of the page
105106
frontmatter: Record<string, any>

‎src/node/contentLoader.ts

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

0 commit comments

Comments
 (0)
Please sign in to comment.