Skip to content

Commit

Permalink
fix($core): content property of additionalPages doesn't work (close: #…
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Nov 29, 2018
1 parent 8a4b5e8 commit 4f505a8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/@vuepress/core/lib/prepare/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const {
fs,
path,
hash,
chalk,
logger,
slugify,
inferTitle,
fileToPath,
Expand Down Expand Up @@ -43,14 +45,15 @@ module.exports = class Page {
permalink,
frontmatter = {},
permalinkPattern
}) {
}, context) {
this.title = title
this._meta = meta
this._filePath = filePath
this._content = content
this._permalink = permalink
this.frontmatter = frontmatter
this._permalinkPattern = permalinkPattern
this._context = context

if (relative) {
this.regularPath = encodeURI(fileToPath(relative))
Expand Down Expand Up @@ -82,7 +85,13 @@ module.exports = class Page {
preRender = {}
}) {
if (this._filePath) {
logger.developer(`static_route`, chalk.cyan(this.path))
this._content = await fs.readFile(this._filePath, 'utf-8')
} else if (this._content) {
logger.developer(`static_route`, chalk.cyan(this.path))
this._filePath = await this._context.writeTemp(`temp-pages/${this.key}.md`, this._content)
} else {
logger.developer(`dynamic_route`, chalk.cyan(this.path))
}

if (this._content) {
Expand Down

0 comments on commit 4f505a8

Please sign in to comment.