I wanted to move away from the default google search that came with my blog theme for a while now. Finally, I found time and some solutions I can build upon to do this in a nice way.
Even though the Hexo theme I’m using offers some search options, I didn’t like any of them. I really like the #jamstack movement, and I’m exploring #serveless options in azure so I wanted to do something with those technologies. I stumbled upon this pretty recent solution built with React, Azure Functions and Azure Cognitive Search. This was a perfect starting point since I also used Azure Cognitive Search in the past to build the Cognitive CMS project, so I know how powerful it is.
As I'm exploring some #jamstack and #serverless options on #azure, I added Azure Cognitive Search to by static blog site https://t.co/7Sn9YfDeyZ
— Dalibor Mesarić (@dalibormesaric) January 6, 2021
What was missing was a quick way to add all my blog posts to Azure Cognitive Search. Luckily there is a hexo-azuresearch plugin available with more details explained in the accompanied blog post.
After installing the plugin and running hexo azuresearch
all of my blog posts were added to the Azure Cognitive Search Index and I was able to explore and query the index with the official Azure Cognitive Search Visual Studio Code Extension.
You can see the end result by trying out search in the header or clicking here.
In the process I made two small pull requests
- https://github.com/dereklegenzoff/azure-search-react-template/pull/21
- https://github.com/artchen/hexo-azuresearch/pull/8
And I made my solutions open source
- https://github.com/developerschallenges/search-api
- https://github.com/developerschallenges/search-client
I plan to use this stack in the future to build even more solutions, but until then I hope this shows how powerful it can be to add these serverless features like Azure Cognitive Search to a static web site.