vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

Searchable tags

Open shailen-naidoo opened this issue 1 year ago • 9 comments

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

shailen-naidoo avatar Nov 24 '23 06:11 shailen-naidoo

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

jtgober avatar Dec 30 '23 17:12 jtgober

@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.

shailen-naidoo avatar Dec 30 '23 17:12 shailen-naidoo

Plus one here.

dgloriaweb avatar Feb 11 '24 07:02 dgloriaweb

+1

saleh-mir avatar Mar 24 '24 22:03 saleh-mir

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

anatolinicolae avatar Jul 06 '24 11:07 anatolinicolae

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

jtgober avatar Jul 08 '24 21:07 jtgober

@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... 🤔

anatolinicolae avatar Jul 08 '24 22:07 anatolinicolae

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

jtgober avatar Jul 08 '24 22:07 jtgober

I wish this happens (native taxonomy/tags/categories in VitePress) :clap: Some VuePress themes had this feature.

mrredtree avatar Aug 07 '24 22:08 mrredtree