Skip to content

Commit 8a4b5e8

Browse files
committedNov 29, 2018
chore($core): using hash-sum to generate page's hash
1 parent 1a897cb commit 8a4b5e8

File tree

1 file changed

+12
-2
lines changed
  • packages/@vuepress/core/lib/prepare

1 file changed

+12
-2
lines changed
 

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@
55
*/
66

77
const { inferDate, DATE_RE } = require('../util/index')
8-
const { extractHeaders, fs, path, fileToPath, parseFrontmatter, getPermalink, inferTitle, slugify } = require('@vuepress/shared-utils')
8+
const {
9+
fs,
10+
path,
11+
hash,
12+
slugify,
13+
inferTitle,
14+
fileToPath,
15+
getPermalink,
16+
extractHeaders,
17+
parseFrontmatter
18+
} = require('@vuepress/shared-utils')
919

1020
/**
1121
* Expose Page class.
@@ -50,7 +60,7 @@ module.exports = class Page {
5060
this.regularPath = encodeURI(permalink)
5161
}
5262

53-
this.key = 'v-' + Math.random().toString(16).slice(2)
63+
this.key = 'v-' + hash(`${this._filePath}${this.regularPath}`)
5464
// Using regularPath first, would be override by permalink later.
5565
this.path = this.regularPath
5666
}

0 commit comments

Comments
 (0)
Please sign in to comment.