docs: 修改 SSR 模板,增加新链接

This commit is contained in:
Zhicheng Wang 2018-10-22 20:20:27 +08:00
parent ea64d68962
commit cb21fcb0c9
2 changed files with 5 additions and 765 deletions

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,8 @@ function composePage(url) {
const ssrContent = contents.replace(/href="(?!http)(.{2,}?)"/gi, 'href="/$1"');
const pageContent = pageTemplate
.replace('<title>Angular Docs</title>', `<title>${title} - Angular 官方文档</title>`)
.replace('<aio-page-content-placeholder></aio-page-content-placeholder>', ssrContent);
.replace('<section class="sidenav-content" role="content" id="docs"></section>',
`<section class="sidenav-content" role="content" id="docs">${ssrContent}</section>`);
mkdirp.sync(path.dirname(`./dist/${url}`));
fs.writeFileSync(`./dist/${url}.html`, minify(pageContent, minifyOptions), 'utf-8');
}