Coder Social home page Coder Social logo

audacia.middleware.robotsmetatagmiddleware's Introduction

Introduction

This repo contains an ASP.NET Core Middleware for adding the X-Robots-Tag HTTP header.

The header tells all web crawler bots whether they are allowed to index the page that it finds (along with any hyperlinks it finds on the page). This is vital as the robots.txt file can be, and often is, ignored by web crawlers.

Getting Started

Running the Example

Included in this repo, there is an example directory which contains an example ASP.NET Core app which responds to all requests for /. The response includes a string array of all HTTP headers added into the generated response.

Consuming the Middleware

The IApplicationBuilder extension method UseXRobotsMetaTagMiddleware adds the middleware to the pipeline. It takes a single parameter of type XRobotsModel, an instance of which can be created using XRobotsModelBuilder. There are two main use cases:

  • If you are writing a private app or API (i.e. one that web crawlers should not index) you can use the XRobotsModelBuilder.CreatePrivateAppDefault() method
  • If you are writing a public-facing app then you should use XRobotsModelBuilder to create your own custom set of directives

For example, using the private app default directives looks like this:

app.UseXRobotsMetaTagMiddleware(XRobotsModelBuilder.CreatePrivateAppDefault().Build());

Contributing

We welcome contributions! Please feel free to check our Contribution Guidlines for feature requests, issue reporting and guidelines.

audacia.middleware.robotsmetatagmiddleware's People

Contributors

richardb355 avatar kieran-wilkinson-audacia avatar

Watchers

 avatar Mark Dyer avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.