Browse Source

improve sidebar

ruki 4 years ago
parent
commit
10714ef3db
5 changed files with 56 additions and 16 deletions
  1. 4 1
      _sidebar.md
  2. 25 1
      build.lua
  3. 1 1
      index.html
  4. 13 13
      sitemap.xml
  5. 13 0
      zh-cn/_sidebar.md

+ 4 - 1
_sidebar.md

@@ -1,4 +1,7 @@
-- Packages
+- Getting Started
+  - [Sponsor](https://xmake.io/#/about/sponsor)
+  - [Quick Start](getting_started.md)
+- Packages (133)
   - [android](packages/android.md)
   - [android](packages/android.md)
   - [bsd](packages/bsd.md)
   - [bsd](packages/bsd.md)
   - [cross](packages/cross.md)
   - [cross](packages/cross.md)

+ 25 - 1
build.lua

@@ -293,10 +293,22 @@ function build_packages()
     local packages = import("scripts.packages", {rootdir = repodir, anonymous = true})()
     local packages = import("scripts.packages", {rootdir = repodir, anonymous = true})()
     os.cd("-")
     os.cd("-")
 
 
+    -- get total packages
+    local total_packages = {}
+    for _, pkgs in pairs(packages) do
+        for _, pkg in ipairs(pkgs) do
+            table.insert(total_packages, pkg.name)
+        end
+    end
+    total_packages = table.unique(total_packages)
+
     -- generate _sidebar.md
     -- generate _sidebar.md
     print("generate _sidebar.md")
     print("generate _sidebar.md")
     local sidebar = io.open("_sidebar.md", "w")
     local sidebar = io.open("_sidebar.md", "w")
-    sidebar:print("- Packages")
+    sidebar:print("- Getting Started")
+    sidebar:print("  - [Sponsor](https://xmake.io/#/about/sponsor)")
+    sidebar:print("  - [Quick Start](getting_started.md)")
+    sidebar:print("- Packages (%s)", #total_packages)
     local plats = table.keys(packages)
     local plats = table.keys(packages)
     table.sort(plats)
     table.sort(plats)
     for _, plat in ipairs(plats) do
     for _, plat in ipairs(plats) do
@@ -304,6 +316,18 @@ function build_packages()
     end
     end
     sidebar:close()
     sidebar:close()
 
 
+    -- generate zh-cn/_sidebar.md
+    print("generate zh-cn/_sidebar.md")
+    local sidebar = io.open("zh-cn/_sidebar.md", "w")
+    sidebar:print("- 快速入门")
+    sidebar:print("  - [赞助](https://xmake.io/#/zh-cn/about/sponsor)")
+    sidebar:print("  - [快速上手](zh-cn/getting_started.md)")
+    sidebar:print("- 包列表 (%s)", #total_packages)
+    for _, plat in ipairs(plats) do
+        sidebar:print("  - [%s](packages/%s.md)", plat, plat)
+    end
+    sidebar:close()
+
     -- generate packages/*.md
     -- generate packages/*.md
     print("generate packages/*.md")
     print("generate packages/*.md")
     for _, plat in ipairs(plats) do
     for _, plat in ipairs(plats) do

+ 1 - 1
index.html

@@ -47,7 +47,7 @@
         '/(?!zh-cn).*/_navbar.md': '/_navbar.md',
         '/(?!zh-cn).*/_navbar.md': '/_navbar.md',
         '/(?!zh-cn).*/_sidebar.md': '/_sidebar.md',
         '/(?!zh-cn).*/_sidebar.md': '/_sidebar.md',
         '/zh-cn/.*/_navbar.md': '/zh-cn/_navbar.md',
         '/zh-cn/.*/_navbar.md': '/zh-cn/_navbar.md',
-        '/zh-cn/_sidebar.md': '/_sidebar.md',
+        '/zh-cn/.*/_sidebar.md': '/zh-cn/_sidebar.md',
       },
       },
       search: {
       search: {
         maxAge: 86400000,
         maxAge: 86400000,

+ 13 - 13
sitemap.xml

@@ -7,67 +7,67 @@
     
     
 <url>
 <url>
   <loc>https://xrepo.xmake.io</loc>
   <loc>https://xrepo.xmake.io</loc>
-  <lastmod>2020-10-30T23:43:07+08:00</lastmod>
+  <lastmod>2020-11-01T11:07:42+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/index.html</loc>
   <loc>https://xrepo.xmake.io/mirror/index.html</loc>
-  <lastmod>2020-11-01T10:51:03+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:10+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/zh-cn/getting_started.html</loc>
   <loc>https://xrepo.xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2020-11-01T10:51:03+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:10+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/getting_started.html</loc>
   <loc>https://xrepo.xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2020-11-01T10:51:03+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:11+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/msys.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/msys.html</loc>
-  <lastmod>2020-11-01T10:51:03+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:11+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/macosx.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/macosx.html</loc>
-  <lastmod>2020-11-01T10:51:03+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:11+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/android.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/android.html</loc>
-  <lastmod>2020-11-01T10:51:03+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:11+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/windows.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/windows.html</loc>
-  <lastmod>2020-11-01T10:51:04+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:11+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/bsd.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/bsd.html</loc>
-  <lastmod>2020-11-01T10:51:04+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:11+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/linux.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/linux.html</loc>
-  <lastmod>2020-11-01T10:51:04+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:12+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/cross.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/cross.html</loc>
-  <lastmod>2020-11-01T10:51:04+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:12+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/mingw.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/mingw.html</loc>
-  <lastmod>2020-11-01T10:51:04+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:12+08:00</lastmod>
 </url>
 </url>
 
 
 <url>
 <url>
   <loc>https://xrepo.xmake.io/mirror/packages/iphoneos.html</loc>
   <loc>https://xrepo.xmake.io/mirror/packages/iphoneos.html</loc>
-  <lastmod>2020-11-01T10:51:04+08:00</lastmod>
+  <lastmod>2020-11-01T11:11:12+08:00</lastmod>
 </url>
 </url>
 
 
 </urlset>
 </urlset>

+ 13 - 0
zh-cn/_sidebar.md

@@ -0,0 +1,13 @@
+- 快速入门
+  - [赞助](https://xmake.io/#/zh-cn/about/sponsor)
+  - [快速上手](zh-cn/getting_started.md)
+- 包列表 (133)
+  - [android](packages/android.md)
+  - [bsd](packages/bsd.md)
+  - [cross](packages/cross.md)
+  - [iphoneos](packages/iphoneos.md)
+  - [linux](packages/linux.md)
+  - [macosx](packages/macosx.md)
+  - [mingw](packages/mingw.md)
+  - [msys](packages/msys.md)
+  - [windows](packages/windows.md)