Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide tags and categories by default? #577

Open
sustained opened this issue Dec 21, 2019 · 1 comment
Open

Provide tags and categories by default? #577

sustained opened this issue Dec 21, 2019 · 1 comment

Comments

@sustained
Copy link

sustained commented Dec 21, 2019

Feature request

What problem does this feature solve?

Right now we have to do something like this in our blog template:

export default {
  computed: {
    tags() {
      return Array.from(
        new Set(
          this.page.posts.reduce((tags, page) => {
            tags.push(...(page.tags || []))
            return tags
          }, [])
        )
      )
    },
    categories() {
      return Array.from(
        new Set(
          this.page.posts.reduce((cats, page) => {
            cats.push(...(page.categories || []))
            return cats
          }, [])
        )
      )
    }, },
}

It's not much work but don't you think it amounts to needless boilerplate, when instead the plugin could just provide a list of all tags and categories by default?

What does the proposed API look like?

See below.

How should this be implemented in your opinion?

Both this.tags and this.categories would be available when injectAllPosts is true.

Alternatively, new options could be added: injectAllTags, injectAllCategories.

Are you willing to work on this yourself?

Yes.

@Siricee
Copy link

Siricee commented Dec 18, 2020

Maybe you can try this package: saber-plugin-classification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants