vuepress-reco / vuepress-theme-reco-1.x

🎨 This is the repo for vuepress-theme-reco 1.
http://v1.vuepress-reco.recoluan.com
MIT License
1.63k stars 320 forks source link

增加自动nav分类判断 | Add automatic nav classification judgment #425

Open viceroyliu opened 1 year ago

viceroyliu commented 1 year ago

Feature request

autoAddCategoryToNavbar Add judgment

file : NavbarLinks.vue code👇

  const parseCategories = computed(() => {
    let arr = [];
    if (Object.values(categorySummary?.categories?.items).length > 0) {
      arr.push({
        text: themeLocal.value.autoAddCategoryToNavbar?.categoryText || 'Categories',
        children: Object.values(categorySummary?.categories?.items || {}).map((c) => ({
          // @ts-ignore
          text: c.label,
          // @ts-ignore
          link: `/categories/${convertToPinyin(c.label)}/1/`,
        }))
      })
    }
    if (Object.values(categorySummary?.tags?.items).length > 0) {
      arr.push({
        text: themeLocal.value.autoAddCategoryToNavbar?.tagText || 'Tags',
        children: Object.values(categorySummary?.tags?.items || {}).map(t => ({
          // @ts-ignore
          text: t.label,
          // @ts-ignore
          link: `/tags/${convertToPinyin(t.label)}/1/`,
        }))
      })
    }
    return arr;
  })

What problem does this feature solve?

When I don't have a tag, I don't add a tag

How should this be implemented in your opinion?

Are you willing to work on this yourself?

viceroyliu commented 1 year ago

这个是2.0的建议。package.json 中的url 指向了这里。