3 votes

Robots Handler

The Robots Handler package provides editors with the ability to dynamically change the contents of a site's robots file. Instead of storing the contents of a robots file on the file system, an editor can specify its contents in an Umbraco content page. The property content is then served via a Http Handler for the current site. This package works for multi-site Umbraco installations, meaning it will serve the correct contents for a requested domain's robots file.

When requested, the handler will find the current site being requested from the content tree. From there, it will use a document type alias to find the first instance of that document type within the current site. If found, the contents of the property alias specified will be served as the contents of the handler response.

Installation

The Robots Handler package can be installed via the package's page on our.umbraco.org or via NuGet. If installing via NuGet, use the following package manager command:

Install-Package RB.RobotsHandler

Configuration

If installing via the NuGet package, you do not have to complete the following steps except for adding values to the new AppSettings. To configure the handler, add the following AppSettings to your web.config file:

<configuration>
    <appSettings>
        <add key="robotsHandlerDocTypeAlias" value="" />
        <add key="robotsHandlerPropertyAlias" value="" />
    </appSettings>
</configuration>

The AppSettings above specify which document type and property your robots file contents reside. It is recommended to specify a property of type Textbox Multiple as this will allow editors or developers to enter content in a similar fashion to static robots file. You can add a robot content property to any document type you wish.

To setup the handler, add the following handler to your web.config file:

<configuration>
    <system.webServer>
        <handlers>
            <add name="RobotsHandler" verb="GET" path="robots.txt" type="RB.RobotsHandler.Handlers.RobotsHandler, RB.RobotsHandler" />
        </handlers>
    </system.webServer>
</configuration>

Screenshots

Package owner

RB

RB

RB has 150 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions: 7.2.x

Package Information

  • Package owner: RB
  • Contributors: Dan Lister
  • Created: 01/12/2014
  • Current version 1.0.0
  • License MIT
  • Downloads on Our: 557