Provide tags and categories by default?
Opened this issue · 1 comments
sustained commented
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 commented
Maybe you can try this package: saber-plugin-classification