Ask coding questions

← Back to all posts
How to make simple html/JS search engine
KellerWorthen

I am wanting to make a search engine that will search just my website to make it more accessible.
Anybody have ideas on how to do this?

Voters
AniV19
MercedesElliot
k9chelsea2
KellerWorthen
Comments
hotnewtop
Coder100

Hello. Here's the thought process:
First, you index all your pages in a js file:

And then, to get some search results, you can just do:

Hopes this helps!

KellerWorthen

@Coder100 I'm not sure I understand.

Coder100

what part? @KellerWorthen

KellerWorthen

@Coder100 Most of it... Did I mention I suck at JavaScript?

seanlnge

If it is only searching your website, you can create an array of all of the pages and then create a function that returns a few of those options.

k9chelsea2

good question I have no clue lol