Browse Source

fix: vuepress sidebar

Sv443 4 months ago
parent
commit
b0ebf60a97
3 changed files with 10 additions and 158 deletions
  1. 6 7
      www/.vuepress/config.ts
  2. 1 94
      www/.vuepress/configs/navbar/en.ts
  3. 3 57
      www/.vuepress/configs/sidebar/en.ts

+ 6 - 7
www/.vuepress/config.ts

@@ -15,21 +15,22 @@ const verMajor = Number(rootPkgJson.version.split(".")![0]);
 
 const componentDir = join(dirname(fileURLToPath(import.meta.url)), "./components/");
 const componentNames = readdirSync(componentDir).map((p) => {
-  const fileNameParts = p.split("/")!.at(-1).split(".");
+  const fileNameParts = p.split("/").at(-1)!.split(".");
   fileNameParts.pop();
   return fileNameParts.join(".");
 });
 
 export default defineUserConfig({
   lang: "en-US",
-  base: process.env.HOST_HOMEPAGE === "true" ? `/v${verMajor}/docs/` : "/",
+  base: process.env.HOST_HOMEPAGE?.trim().toLowerCase() === "true" ? `/v${verMajor}/docs/` : "/",
   title: "geniURL",
-  description: "A simple JSON and XML REST API to search for song metadata, the lyrics URL and lyrics translations on genius.com",
+  description: "JSON and XML REST API to search for song metadata, lyrics URL and lyrics translations via the genius.com API without requiring an API key.",
   theme: defaultTheme({
     // logo: "https://vuejs.press/images/hero.png",
     navbar: navbarEn,
     sidebar: sidebarEn,
   }),
+  // @ts-ignore
   bundler: viteBundler(),
   plugins: [
     seoPlugin({
@@ -38,12 +39,10 @@ export default defineUserConfig({
     }),
     sitemapPlugin({
       hostname: "https://api.sv443.net",
+      changefreq: "weekly",
     }),
     registerComponentsPlugin({
-      components: componentNames.reduce((a, c) => {
-        a[c] = join(componentDir, `${c}.vue`);
-        return a;
-      }, {}),
+      components: componentNames.reduce((a, c) => ({ ...a, [c]: join(componentDir, `${c}.vue`) }), {}),
     }),
   ],
 });

+ 1 - 94
www/.vuepress/configs/navbar/en.ts

@@ -23,97 +23,4 @@ export const navbarEn: NavbarOptions = [
     text: "Discord",
     link: "https://dc.sv443.net",
   },
-  /*{
-    text: 'Routes',
-    children: [
-      {
-        text: 'Core',
-        children: [
-          {
-            text: 'CLI',
-            link: '/reference/cli.html',
-          },
-          '/reference/config.md',
-          '/reference/frontmatter.md',
-          '/reference/components.md',
-          '/reference/plugin-api.md',
-          '/reference/theme-api.md',
-          '/reference/client-api.md',
-          '/reference/node-api.md',
-        ],
-      },
-      {
-        text: 'Bundlers',
-        children: [
-          '/reference/bundler/vite.md',
-          '/reference/bundler/webpack.md',
-        ],
-      },
-      {
-        text: 'Ecosystem',
-        children: [
-          {
-            text: 'Default Theme',
-            link: 'https://ecosystem.vuejs.press/themes/default/',
-          },
-          {
-            text: 'Plugins',
-            link: 'https://ecosystem.vuejs.press/plugins/',
-          },
-        ],
-      },
-    ],
-  },
-  {
-    text: 'Learn More',
-    children: [
-      {
-        text: 'Advanced',
-        children: [
-          '/advanced/architecture.md',
-          '/advanced/plugin.md',
-          '/advanced/theme.md',
-          {
-            text: 'Cookbook',
-            link: '/advanced/cookbook/',
-          },
-        ],
-      },
-      {
-        text: 'Resources',
-        children: [
-          {
-            text: 'Ecosystem',
-            link: 'https://ecosystem.vuejs.press/',
-          },
-          {
-            text: 'MarketPlace',
-            link: 'https://marketplace.vuejs.press',
-          },
-          {
-            text: 'Contributing Guide',
-            link: 'https://github.com/vuepress/core/blob/main/CONTRIBUTING.md',
-          },
-        ],
-      },
-    ],
-  },
-  {
-    text: `v${VERSION}`,
-    children: [
-      {
-        text: 'Changelog',
-        link: 'https://github.com/vuepress/core/blob/main/CHANGELOG.md',
-      },
-      {
-        text: 'v1.x',
-        link: 'https://v1.vuepress.vuejs.org',
-      },
-      {
-        text: 'v0.x',
-        link: 'https://v0.vuepress.vuejs.org',
-      },
-    ],
-  },*/
-  // TODO: remove the type assertion
-] as NavbarOptions;
+] satisfies NavbarOptions;

+ 3 - 57
www/.vuepress/configs/sidebar/en.ts

@@ -1,6 +1,6 @@
 import type { SidebarOptions } from "@vuepress/theme-default";
 
-export const sidebarEn: SidebarOptions = {
+export const sidebarEn = {
   "/docs/": [
     {
       text: "Introduction",
@@ -8,6 +8,7 @@ export const sidebarEn: SidebarOptions = {
     },
     {
       text: "Routes",
+      link: "/docs/routes/README.md",
       children: [
         "/docs/routes/README.md",
         "/docs/routes/search.md",
@@ -20,59 +21,4 @@ export const sidebarEn: SidebarOptions = {
       link: "/docs/try-it.md",
     },
   ],
-  /*'/advanced/': [
-    {
-      text: 'Advanced',
-      children: [
-        '/advanced/architecture.md',
-        '/advanced/plugin.md',
-        '/advanced/theme.md',
-      ],
-    },
-    {
-      text: 'Cookbook',
-      children: [
-        '/advanced/cookbook/README.md',
-        '/advanced/cookbook/usage-of-client-config.md',
-        '/advanced/cookbook/adding-extra-pages.md',
-        '/advanced/cookbook/making-a-theme-extendable.md',
-        '/advanced/cookbook/passing-data-to-client-code.md',
-        '/advanced/cookbook/markdown-and-vue-sfc.md',
-        '/advanced/cookbook/resolving-routes.md',
-      ],
-    },
-  ],
-  '/reference/': [
-    {
-      text: 'Core',
-      collapsible: true,
-      children: [
-        '/reference/cli.md',
-        '/reference/config.md',
-        '/reference/frontmatter.md',
-        '/reference/components.md',
-        '/reference/plugin-api.md',
-        '/reference/theme-api.md',
-        '/reference/client-api.md',
-        '/reference/node-api.md',
-      ],
-    },
-    {
-      text: 'Bundlers',
-      children: ['/reference/bundler/vite.md', '/reference/bundler/webpack.md'],
-    },
-    {
-      text: 'Ecosystem',
-      children: [
-        {
-          text: 'Default Theme',
-          link: 'https://ecosystem.vuejs.press/themes/default/',
-        },
-        {
-          text: 'Plugins',
-          link: 'https://ecosystem.vuejs.press/plugins/',
-        },
-      ],
-    },
-  ],*/
-};
+} satisfies SidebarOptions;