Closed arpit-dwivedi closed 3 years ago
Today's task was to figure out how to add search functionality to a static website.
I've worked with vanilla Javascript where filter can be used to add search functionality.
An array of objects can be created and each object will have some keywords and based on these keywords the search results can be filtered.
I read about jekyll and other static web page generators but couldn't really figure out how to implement the search functionality using those tools.
I have read some of the articles for implementing search functionality in static websites but I can't get any conclusion for that.
There are some techniques by which we can implement search in static website but for that we have learn new framework and its a bit tricky and time consuming.
The links you have suggested if we implement it may be affective or may be not for some of the times.
If there is requirement for search functionality it will be better to be use dynamically by using server and database.
I've tried to implement the search functionality using Vanilla Javascript.
I've created a painting catalog. In this, one can write the name of the painting and when the user clicks the search button then the result is displayed on the web page.
In this, I've created an array of objects containing all the required information of the painting according to which HTML is dynamically created in javascript depending on the input given by the user.
For the search functionality here I've only used the name of the painting but for our blog page, we can also include the keywords in the filter function so that even if a user doesn't provide the exact topic of the blog then also the related blogs could be displayed if even one of the keyword is matching. Then, we can provide the link to the complete article directing it to another HTML page.
https://www.youtube.com/watch?v=M3PbUwgEecU https://www.youtube.com/watch?v=-bqDzd1-Prc
Search for available options to enable "Search" on static webpages.
Some of the methods are given here and here , you can check if anyone can work with our website, and search for other options as well, like if we can use elastic search here.