mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
add wrapPagesHTML which renders html snippets in pages inside of a header + footer
This commit is contained in:
parent
078b379dae
commit
786fdbb136
2 changed files with 23 additions and 1 deletions
|
@ -375,7 +375,19 @@ function execute(port) {
|
|||
))
|
||||
)
|
||||
) {
|
||||
res.send(fs.readFileSync(htmlFile, {encoding: 'utf8'}));
|
||||
if (siteConfig.wrapPagesHTML) {
|
||||
removeModuleAndChildrenFromCache("../core/Site.js");
|
||||
const Site = require("../core/Site.js");
|
||||
const str = renderToStaticMarkup(
|
||||
<Site language="en" config={siteConfig}>
|
||||
<div dangerouslySetInnerHTML={{__html: fs.readFileSync(htmlFile, { encoding: "utf8" })}} />
|
||||
</Site>
|
||||
);
|
||||
|
||||
res.send(str);
|
||||
} else {
|
||||
res.send(fs.readFileSync(htmlFile, { encoding: "utf8" }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue