fix: reload siteConfig.js automatically when locally served page is refreshed (#1509)

* fix: livereload siteConfig

* fix test

* nits
This commit is contained in:
Endi 2019-05-22 22:31:51 +07:00 committed by GitHub
parent aa157969cf
commit 166816af40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 53 additions and 42 deletions

View file

@ -360,7 +360,7 @@ function generateMetadataDocs() {
}
// process metadata for blog posts and save into core/MetadataBlog.js
function generateMetadataBlog() {
function generateMetadataBlog(config = siteConfig) {
const metadatas = [];
const files = glob.sync(`${CWD}/blog/**/*.*`);
@ -372,7 +372,7 @@ function generateMetadataBlog() {
if (extension !== '.md' && extension !== '.markdown') {
return;
}
const metadata = blog.getMetadata(file);
const metadata = blog.getMetadata(file, config);
// Extract, YYYY, MM, DD from the file name
const filePathDateArr = path.basename(file).split('-');
metadata.date = new Date(