mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 12:47:14 +02:00
Regenerate blog metadata on request to blog (#590)
This commit is contained in:
parent
266b37498a
commit
d3fd347d21
1 changed files with 7 additions and 4 deletions
|
@ -269,13 +269,16 @@ function execute(port) {
|
||||||
res.send(feed('rss'));
|
res.send(feed('rss'));
|
||||||
});
|
});
|
||||||
|
|
||||||
// handle all requests for blog pages and posts
|
// Handle all requests for blog pages and posts.
|
||||||
app.get(/blog\/.*html$/, (req, res) => {
|
app.get(/blog\/.*html$/, (req, res) => {
|
||||||
// generate all of the blog pages
|
// Regenerate the blog metadata in case it has changed. Consider improving
|
||||||
|
// this to regenerate on file save rather than on page request.
|
||||||
|
reloadMetadataBlog();
|
||||||
|
// Generate all of the blog pages.
|
||||||
removeModuleAndChildrenFromCache(join('..', 'core', 'BlogPageLayout.js'));
|
removeModuleAndChildrenFromCache(join('..', 'core', 'BlogPageLayout.js'));
|
||||||
const BlogPageLayout = require(join('..', 'core', 'BlogPageLayout.js'));
|
const BlogPageLayout = require(join('..', 'core', 'BlogPageLayout.js'));
|
||||||
const blogPages = {};
|
const blogPages = {};
|
||||||
// make blog pages with 10 posts per page
|
// Make blog pages with 10 posts per page.
|
||||||
const perPage = 10;
|
const perPage = 10;
|
||||||
for (
|
for (
|
||||||
let page = 0;
|
let page = 0;
|
||||||
|
@ -535,7 +538,7 @@ function execute(port) {
|
||||||
console.error('No response');
|
console.error('No response');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error('request failed:', err);
|
console.error('Request failed:', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue