javascripthtmlcsssearchtagging

How to add a tag system to the posts of my website using only html, js and css?


i am developing a website. I want to add a tag system to the blog/posts i make on my website and I'd like to know how. The specification of "only html, css and js" is because this is going to be a neocities website and neocities only accepts those three languages on the websites hosted there. No php or sql. I don't have much so far but i already made a search bar:

<form class="searchBar" action="">
    <input type="text" placeholder="Search..." name="search">
    <button type="submit"><img src="../img/logo_search.png"></button>
</form>

Thanks to anyone who has the answer!


Solution

  • JS is what you want to write that kind of logic in, you would need a function that searches for tags and a tag identifier like #. this function should get you started.

    someString.split(' ').filter(v=> v.startsWith('#'))