Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/waldekmastykarz/jekyll-azure-search
Configure Azure Search for your Jekyll blog
https://github.com/waldekmastykarz/jekyll-azure-search
Last synced: 28 days ago
JSON representation
Configure Azure Search for your Jekyll blog
- Host: GitHub
- URL: https://github.com/waldekmastykarz/jekyll-azure-search
- Owner: waldekmastykarz
- Created: 2019-08-17T09:14:24.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-20T13:35:12.000Z (about 3 years ago)
- Last Synced: 2024-04-23T14:10:28.584Z (7 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Create and build Azure Search index for your Jekyll blog
Jekyll is a great blogging platform which unfortunately lacks a search capability. Luckily, you can easily push your Jekyll blog's content to an Azure Search instance and use it to provide your readers with a search capability.
Following are two node.js scripts that can help you create and build a search index for your Jekyll blog.
## Prerequisites
1. Clone this repository
1. Run `npm i`
1. In your Azure subscription create a new instance of Azure Search and copy the admin key which you will need to configure the index## Creating the index
The first step is to create the definition of the search index. As a starting point you can use the definition provided in the [index.json](index.json) file but feel free to extend it as necessary using the additional information provided at [https://msdn.microsoft.com/library/azure/dn798941.aspx?WT.mc_id=m365-0000-wmastyka](https://msdn.microsoft.com/library/azure/dn798941.aspx?WT.mc_id=m365-0000-wmastyka).
When done run the **createIndex.js** script:
```sh
node createIndex.js --indexFile=./index.json --serviceName=jekyllblog --indexName=posts --adminKey=ABC
```Following are the arguments that you have to pass:
* **indexFile** - path to the .json file holding the schema of your search index
* **serviceName** - name of your Azure Search instance
* **indexName** - name of the index to be created
* **adminKey** - the admin key to your Azure Search instance> **Important**: if you want to be able to search on your blog using client-side calls, don't forget to configure CORS for the newly created index on the Azure Management Portal
## Rebuilding the index
The next step is to fill the index with the contents of your Jekyll blog so that your readers can search on your blog.
Run the **rebuildIndex.js** script:
```sh
node rebuildIndex.js --postsDir=./_posts --serviceName=jekyllblog --indexName=posts --adminKey=ABC --blogUrl=https://jekyllblog.hosting.io
```Following are the arguments that you have to pass:
* **postsDir** - path to *_posts* folder in your Jekyll blog
* **serviceName** - name of your Azure Search instance
* **indexName** - name of the index to be created
* **adminKey** - the admin key to your Azure Search instance
* **blogUrl** - the URL of your blog without the trailing slash, eg. *https://jekyllblog.hosting.io*. This URL is used to prepend your blog posts' slugsHaving completed these steps the last thing left for you to do, is to have the search box on your blog call the Azure Search API. More information about it is available on [https://msdn.microsoft.com/library/azure/dn798927.aspx?WT.mc_id=m365-0000-wmastyka](https://msdn.microsoft.com/library/azure/dn798927.aspx?WT.mc_id=m365-0000-wmastyka).