vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.98k stars 1.94k forks source link

Searchable tags #3254

Open shailen-naidoo opened 7 months ago

shailen-naidoo commented 7 months ago

Is your feature request related to a problem? Please describe.

I am always frustrated when searching for related content across the site.

Describe the solution you'd like

It might be a great idea to have some kind of tag system very much like the way a hashtag works, where you can set the tags in the frontmatter and the vitepress tool would automatically inject those tags at the top of the page or the bottom of the page. These tags would then become searchable via the built-in search tool or you could have a list of tags in the sidebar appear, so when you click on a tag it will display or the related content that is associated to that tag.

Describe alternatives you've considered

I have not tried any alternatives, I believe that Vitepress does not provide an alternative solution.

Additional context

I am building a resource for making the law more approachable and accessible to the everyday South African called lawforidiots.org, I have realized that the way that i intend for the content to be laid out would require some kind of tagging system because there will eventually be a lot of content that is related overtime. Therefore, a tagging system would be the best way to go. I see there is another ticket https://github.com/vuejs/vitepress/issues/3029 but I thought I would create a duplicate just for more context on the matter

Validations

jtgober commented 6 months ago

I’d like to second this. Adding tags to the frontmatter would be an awesome addition. I believe docusaurus does this for their blogs

shailen-naidoo commented 6 months ago

@jtgober Having searchable tags would be such an amazing feature. For example, with the in-built search you could just do tag:<tag-name> to find all the related documents.

dgloriaweb commented 5 months ago

Plus one here.

saleh-mir commented 3 months ago

+1

anatolinicolae commented 4 days ago

We've tried implementing this in an awful way, but already feels better since search now includes the result we want to pop for certain tags.

https://github.com/thundersquared/apiscp-notes/commit/f2d2641cf2027de0fef3f1167c9373259363a956

Best thing I guess would probably be including rendered frontmatter fields in the IndexObject to allow then (1) field resolution via dot-notation and (2) weighting based on custom fields, achieving something similar to what's described in MiniSearch's README:

https://github.com/lucaong/minisearch/blob/4b231376363918b7fa487cb1735a09efb99fe963/README.md?plain=1#L238-L250

jtgober commented 1 day ago

Is this more an update to searching? Moving from something like algolia to minisearch?

anatolinicolae commented 1 day ago

@jtgober our solution you mean? Yeah, we're trying to move away from Algolia 'cause it provides subpar results. Either way I think searchable tags would apply to MiniSearch only, dunno about Algolia... 🤔

jtgober commented 1 day ago

No I think that's cool. Looking forward to seeing what you all cook up