DEV Community

Frederik Van Lierde
Frederik Van Lierde

Posted on

IndexNow Protocol with .Net

IndexNow is an open-source protocol, created by Microsoft, to get your website get indexed faster. The protocol is supported by Bing and Yandex and Google is testing it.

With the IndexNow protocol, search engine bots don't need to perform crawls on your website to determine whether a page has been updated.

This reduces unnecessary site load, reducing energy consumption and enabling servers to work more efficiently.

Steps to implement IndexNow

  1. Generate API Key
    API key is needed to match the ownership of the domain along with submitted URLs; should be of minimum 8 characters.
    Generate your Key

  2. Host API key
    Host your API key on the root directory in txt format. This will help in verifying the ownership of the submitted URLs.
    Ex. https://www.yourdomain.com/6e63101cf92a4766a5880804bb9ac578.txt.txt with 6e63101cf92a4766a5880804bb9ac578 in the content of the txt file

  3. Submit URLs with parameters
    Webmasters can submit individual or bulk URLs. Just submit your key location as URL parameter.
    Ex. https://www.bing.com/indexnow?url=http://www.example.com/product.html&key=6e63101cf92a4766a5880804bb9ac578

.Net Nuget Package

You can use the .Net NuGet Package CodeHelper.API.IndexNow

The Code

using CodeHelper.API.IndexNow;

IndexNowHelper _helper = new("your-key");
await _helper.Submit("your ur");
Enter fullscreen mode Exit fullscreen mode

Submit in Bulk

using CodeHelper.API.IndexNow;

IndexNowHelper _helper = new("your-key", "your domain");

List<string> urlList = new();
urlList.Add("url 1");
urlList.Add("url 2");
urlList.Add("url 3");
urlList.Add("url 4");

string _response = await _h.SubmitBulk(urlList);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)