Skip to content

Commit 4f505a8

Browse files
committed
fix($core): content property of additionalPages doesn't work (close: #1050)
1 parent 8a4b5e8 commit 4f505a8

File tree

1 file changed

+10
-1
lines changed
  • packages/@vuepress/core/lib/prepare

1 file changed

+10
-1
lines changed

packages/@vuepress/core/lib/prepare/Page.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const {
99
fs,
1010
path,
1111
hash,
12+
chalk,
13+
logger,
1214
slugify,
1315
inferTitle,
1416
fileToPath,
@@ -43,14 +45,15 @@ module.exports = class Page {
4345
permalink,
4446
frontmatter = {},
4547
permalinkPattern
46-
}) {
48+
}, context) {
4749
this.title = title
4850
this._meta = meta
4951
this._filePath = filePath
5052
this._content = content
5153
this._permalink = permalink
5254
this.frontmatter = frontmatter
5355
this._permalinkPattern = permalinkPattern
56+
this._context = context
5457

5558
if (relative) {
5659
this.regularPath = encodeURI(fileToPath(relative))
@@ -82,7 +85,13 @@ module.exports = class Page {
8285
preRender = {}
8386
}) {
8487
if (this._filePath) {
88+
logger.developer(`static_route`, chalk.cyan(this.path))
8589
this._content = await fs.readFile(this._filePath, 'utf-8')
90+
} else if (this._content) {
91+
logger.developer(`static_route`, chalk.cyan(this.path))
92+
this._filePath = await this._context.writeTemp(`temp-pages/${this.key}.md`, this._content)
93+
} else {
94+
logger.developer(`dynamic_route`, chalk.cyan(this.path))
8695
}
8796

8897
if (this._content) {

0 commit comments

Comments
 (0)