From 747b86d7928b5a7a0ca358754d6b731efde58e01 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Fri, 21 Sep 2018 08:49:57 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E6=AD=A3=20SEO=20=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../translator/assets/aio-shell-template.html | 184 +++++++++--------- aio/tools/translator/bin/ssr.ts | 6 +- 2 files changed, 96 insertions(+), 94 deletions(-) diff --git a/aio/tools/translator/assets/aio-shell-template.html b/aio/tools/translator/assets/aio-shell-template.html index d901a5a467..982cf903c8 100644 --- a/aio/tools/translator/assets/aio-shell-template.html +++ b/aio/tools/translator/assets/aio-shell-template.html @@ -41,12 +41,12 @@ width="150" class="ng-star-inserted"> @@ -67,7 +67,7 @@
@@ -82,42 +82,42 @@ @@ -149,27 +149,27 @@ + href="/guide/architecture" title="Angular 应用的基本构造块" target="_self"> 架构概览
+ href="/guide/architecture-modules" title="关于模块。" target="_self"> 模块(NgModule)简介
+ href="/guide/architecture-components" title="关于组件、模板和视图。" target="_self"> 组件简介
+ href="/guide/architecture-services" title="关于服务与依赖注入。" target="_self"> 服务与 DI 简介
+ href="/guide/architecture-next-steps" title="学完基础知识之后……" target="_self"> 后续步骤
@@ -189,57 +189,57 @@
+ href="/guide/displaying-data" title="属性绑定可以帮助应用把数据显示在界面上" target="_self"> 显示数据
+ href="/guide/component-interaction" title="在不同的指令和组件之间共享信息" target="_self"> 组件交互
+ href="/guide/component-styles" title="添加专属于某个组件的样式" target="_self"> 组件样式
+ href="/guide/elements" title="把组件转换成自定义元素。" target="_self"> Angular 自定义元素
+ href="/guide/dynamic-component-loader" title="动态加载组件" target="_self"> 动态组件
+ href="/guide/attribute-directives" title="属性型指令把行为添加到现有元素上。" target="_self"> 属性型指令
+ href="/guide/structural-directives" title="结构型指令可以操纵页面的布局" target="_self"> 结构型指令
+ href="/guide/pipes" title="管道可以在模板中转换显示的内容。" target="_self"> 管道 + href="/guide/animations" title="Angular 动画体系指南" target="_self"> 动画 @@ -259,27 +259,27 @@ + href="/guide/form-validation" title="验证用户的表单输入" target="_self"> 表单验证
+ href="/guide/dynamic-form" title="使用FormGroup渲染动态表单" target="_self"> 动态表单
@@ -299,34 +299,34 @@ + href="/guide/observables" title="" target="_self"> 可观察对象(Observable) + href="/guide/rx-library" title="" target="_self"> RxJS 库
+ href="/guide/observables-in-angular" title="" target="_self"> Angular 中的可观察对象
+ href="/guide/practical-observable-usage" title="" target="_self"> 用法实战 + href="/guide/comparing-observables" title="" target="_self"> 与其它技术的比较 @@ -344,62 +344,62 @@
+ href="/guide/ngmodules" title="使用 NgModule 让你的应用更高效" target="_self"> NgModule 简介
+ href="/guide/frequent-ngmodules" title="介绍最常用的 Angular 模块" target="_self"> 常用模块
+ href="/guide/module-types" title="介绍特性模块的几种类型" target="_self"> 特性模块的分类
+ href="/guide/entry-components" title="关于 Angular 中入口组件的一切" target="_self"> 入口组件
+ href="/guide/feature-modules" title="创建特性模块,以组织你的代码" target="_self"> 特性模块
+ href="/guide/providers" title="服务提供商与 Angular 模块" target="_self"> 服务提供商 + href="/guide/singleton-services" title="创建单例应用" target="_self"> 单例应用
+ href="/guide/lazy-loading-ngmodules" title="惰性加载模块,以提高应用的性能" target="_self"> 惰性加载的特性模块
+ href="/guide/ngmodule-api" title="理解 NgModule 的那些细节。" target="_self"> NgModule API
+ href="/guide/ngmodule-faq" title="回答关于 NgModules 的常见问题。" target="_self"> NgModule 常见问题
@@ -419,44 +419,44 @@
+ href="/guide/dependency-injection-in-action" title="依赖注入的使用技巧" target="_self"> DI 实用技巧
@@ -475,17 +475,17 @@
@@ -503,37 +503,37 @@
+ href="/guide/browser-support" title="浏览器支持与 Polyfills 指南" target="_self"> 浏览器支持
+ href="/guide/npm-packages" title="建议的 npm 包,以及如何指定包的依赖。" target="_self"> npm 包
+ href="/guide/aot-compiler" title="学习如何使用 AOT 预编译器。" target="_self"> 预先(AOT)编译
+ href="/guide/deployment" title="学习如何部署你的 Angular 应用。" target="_self"> 部署
@@ -553,27 +553,27 @@ @@ -593,12 +593,12 @@
+ href="/guide/updating" title="关于如何把 Angular 应用升级到最新版的信息。" target="_self"> 更新你的项目
+ href="/guide/releases" title="Angular 的版本、发布、支持与弃用策略。" target="_self"> Angular 的版本发布
@@ -618,40 +618,40 @@
+ href="/guide/upgrade" title="把 AngularJS 应用增量式的升级到 Angular。" target="_self"> 升级步骤
@@ -659,7 +659,7 @@ @@ -715,9 +715,9 @@
-

Powered by Google ©2010-2018. 代码授权方式:MIT-style License. 文档授权方式: Powered by Google ©2010-2018. 代码授权方式:MIT-style License. 文档授权方式:CC BY 4.0.

当前版本:6.1.1-local+sha.fe5eef45e. diff --git a/aio/tools/translator/bin/ssr.ts b/aio/tools/translator/bin/ssr.ts index 49f13ae2f8..eeaf8a4e84 100644 --- a/aio/tools/translator/bin/ssr.ts +++ b/aio/tools/translator/bin/ssr.ts @@ -11,10 +11,12 @@ function buildSsrPages(): void { .map((entry) => entry.replace(/^"url": "(.*?)".*$/, '$1')) .filter(url => url.slice(0, 4) !== 'http') .forEach(url => { - const generated: { title: string, content: string } = JSON.parse(fs.readFileSync(`./dist/generated/docs/${url}.json`, 'utf-8')); + const generated: { title: string, contents: string } = JSON.parse(fs.readFileSync(`./dist/generated/docs/${url}.json`, 'utf-8')); + + const content = generated.contents.replace(/href="(?!http)(.{2,}?)"/gi, 'href="/$1"'); const pageContent = pageTemplate .replace('Angular Docs', `${generated.title} - Angular 官方文档`) - .replace('', generated.content); + .replace('', content); mkdirp.sync(path.dirname(`./dist/${url}`)); fs.writeFileSync(`./dist/${url}.html`, pageContent, 'utf-8'); });