From ac6c4d3a056f081d05ae94233f24512df94b07b1 Mon Sep 17 00:00:00 2001 From: liuboaibc Date: Wed, 13 Jan 2021 15:16:10 +0800 Subject: [PATCH 1/4] add popular docs link Signed-off-by: liuboaibc --- i18n/zh.yaml | 2 +- static/images/docs/22-hover.svg | 2 +- static/images/docs/22.svg | 2 +- static/images/docs/26.svg | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n/zh.yaml b/i18n/zh.yaml index 273531b45..392d5d173 100644 --- a/i18n/zh.yaml +++ b/i18n/zh.yaml @@ -129,4 +129,4 @@ - id: Install on Kubernetes translation: 在 Kubernetes 安装 - id: Install on Linux - translation: 在 Linux 安装 \ No newline at end of file + translation: 在 Linux 安装 diff --git a/static/images/docs/22-hover.svg b/static/images/docs/22-hover.svg index 558a4ee37..149fc496f 100644 --- a/static/images/docs/22-hover.svg +++ b/static/images/docs/22-hover.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/static/images/docs/22.svg b/static/images/docs/22.svg index f99c2bf72..d4ab4a04c 100644 --- a/static/images/docs/22.svg +++ b/static/images/docs/22.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/static/images/docs/26.svg b/static/images/docs/26.svg index 314dcefe5..b8c46427d 100644 --- a/static/images/docs/26.svg +++ b/static/images/docs/26.svg @@ -1 +1 @@ - \ No newline at end of file + From c6e8b117ac98e26d51f34a1a3c110ae3a7cb7d3b Mon Sep 17 00:00:00 2001 From: liuboaibc Date: Wed, 13 Jan 2021 16:15:33 +0800 Subject: [PATCH 2/4] create pdf Signed-off-by: liuboaibc --- README.md | 13 + config/_default/config.toml | 2 +- content/en/all-docs/_index.md | 0 content/zh/all-docs/_index.md | 0 layouts/_default/_markup/render-image.html | 7 + layouts/_default/_markup/render-link.html | 12 +- layouts/all-docs/list.html | 637 +++++++++++++++++++++ 7 files changed, 669 insertions(+), 2 deletions(-) create mode 100644 content/en/all-docs/_index.md create mode 100644 content/zh/all-docs/_index.md create mode 100644 layouts/_default/_markup/render-image.html create mode 100644 layouts/all-docs/list.html diff --git a/README.md b/README.md index 282806fcf..f2ea087e6 100644 --- a/README.md +++ b/README.md @@ -145,3 +145,16 @@ Total in 2396 ms #### Get the already built static content You will find the previously generated content in the `public` directory. + + +## Create Docs PDF + +``` +hugo +``` + +``` +cat ./public/all-docs/index.html | wkhtmltopdf --outline-depth 2 --enable-internal-links - ./static/pdf/all-docs.pdf + +cat ./public/zh/all-docs/index.html | wkhtmltopdf --outline-depth 2 --enable-internal-links - ./static/pdf/all-docs-zh.pdf +``` \ No newline at end of file diff --git a/config/_default/config.toml b/config/_default/config.toml index d99090c50..174934129 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -1,4 +1,4 @@ -baseURL = "https://kubesphere-v3.netlify.app" +baseURL = "https://kubesphere.io" enableRobotsTXT = true diff --git a/content/en/all-docs/_index.md b/content/en/all-docs/_index.md new file mode 100644 index 000000000..e69de29bb diff --git a/content/zh/all-docs/_index.md b/content/zh/all-docs/_index.md new file mode 100644 index 000000000..e69de29bb diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 000000000..91d49c375 --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,7 @@ +

+ {{ if strings.HasPrefix .Destination "http" }} + {{ .Text }} + {{ else }} + {{ .Text }} + {{ end }} +

\ No newline at end of file diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 943e7c4a7..8c1534ebe 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1 +1,11 @@ -{{ .Text }} \ No newline at end of file +{{ if strings.HasPrefix .Destination "http" }} + {{ .Text }} +{{ else }} + {{ $page := .Page.GetPage .Destination }} + {{ if $page }} + {{ .Text }} + {{ else}} + {{ $page := .Page.GetPage (substr .Destination 3 -1) }} + {{ .Text }} + {{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/all-docs/list.html b/layouts/all-docs/list.html new file mode 100644 index 000000000..85adc5c42 --- /dev/null +++ b/layouts/all-docs/list.html @@ -0,0 +1,637 @@ + + + + + + + Kubesphere Doc + + + + + + + +

Content

+ + {{ define "table" }} +
  • {{ .LinkTitle }}
  • + {{ if .IsSection }} +
      + {{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} + {{ template "table" . }} + {{ end }} +
    + {{ end }} + {{ end }} + +
      + {{ with .Site.GetPage "section" "docs" }} + {{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} + {{ template "table" . }} + {{ end }} + {{ end }} +
    + +
    +
    + + {{ define "content" }} +

    {{ .LinkTitle }}

    +
    + {{ .Content }} +
    +
    +
    + {{ if .IsSection }} + {{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} + {{ template "content" . }} + {{ end }} + {{ end }} + {{ end }} + + + {{ with .Site.GetPage "section" "docs" }} + {{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} + {{ template "content" . }} + {{ end }} + {{ end }} + + \ No newline at end of file From 4e5b95da0a89407bc7f9c335f9f5205ad889e55b Mon Sep 17 00:00:00 2001 From: liuboaibc Date: Tue, 23 Feb 2021 11:10:48 +0800 Subject: [PATCH 3/4] update Signed-off-by: liuboaibc --- i18n/en.yaml | 2 ++ i18n/zh.yaml | 2 ++ layouts/all-docs/list.html | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/i18n/en.yaml b/i18n/en.yaml index 6868a89c4..c4dc39a71 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -60,6 +60,8 @@ translation: Last updated - id: What’s on this Page translation: What’s on this Page +- id: Content + translation: Content - id: Previous translation: Previous - id: Next diff --git a/i18n/zh.yaml b/i18n/zh.yaml index 392d5d173..cbbeda6b9 100644 --- a/i18n/zh.yaml +++ b/i18n/zh.yaml @@ -60,6 +60,8 @@ translation: 最新更新 - id: What’s on this Page translation: 页面内容 +- id: Content + translation: 目录 - id: Previous translation: 上一篇 - id: Next diff --git a/layouts/all-docs/list.html b/layouts/all-docs/list.html index 85adc5c42..90026ac97 100644 --- a/layouts/all-docs/list.html +++ b/layouts/all-docs/list.html @@ -589,7 +589,7 @@ -

    Content

    +

    {{ i18n "Content" }}

    {{ define "table" }}
  • {{ .LinkTitle }}
  • From 8019015c1fa0ab0190510e23d7c9db849be355e9 Mon Sep 17 00:00:00 2001 From: liuboaibc Date: Thu, 8 Jul 2021 11:56:23 +0800 Subject: [PATCH 4/4] fix Signed-off-by: liuboaibc --- layouts/docs/second.html | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/layouts/docs/second.html b/layouts/docs/second.html index add15eaca..b92810b3c 100644 --- a/layouts/docs/second.html +++ b/layouts/docs/second.html @@ -117,29 +117,14 @@ height="0" width="0" style="display:none;visibility:hidden"> - - {{ define "content" }} - {{ if .context.IsSection }} - {{ .context.LinkTitle }} - {{ else }} - {{ .context.LinkTitle }} - {{ end }} -

    {{ .context.Description }}

    - {{ $count := add .count 1 }} - {{ if .context.IsSection }} - {{ range (union (where .context.Pages ".context.Params._build.render" "!=" false) .context.Sections).ByWeight }} - {{ template "content" (dict "context" . "count" $count) }} - {{ end }} - {{ else}} - {{ end }} - {{ end }}

    {{ .Title }}

    {{ .Content }} {{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} - {{ template "content" (dict "context" . "count" 2) }} +

    {{ .LinkTitle }}

    +

    {{ .Description }}

    {{ end }}