DEV Community

Frederik Van Lierde
Frederik Van Lierde

Posted on

3

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

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay