All Projects → stormid → robotify-netcore

stormid / robotify-netcore

Licence: MIT license
Provides robots.txt middleware for .NET core

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to robotify-netcore

Cometary
Roslyn extensions, with a touch of meta-programming.
Stars: ✭ 31 (+106.67%)
Mutual labels:  netcore
MudBlazor
Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
Stars: ✭ 4,539 (+30160%)
Mutual labels:  netcore
Hammer
Simple, reliable FHIR validator
Stars: ✭ 27 (+80%)
Mutual labels:  netcore
dark-sky-core
A .NET Standard Library for using the Dark Sky API.
Stars: ✭ 55 (+266.67%)
Mutual labels:  netcore
DBUtil
最新版本请移步:https://gitee.com/jackletter/DBUtil
Stars: ✭ 24 (+60%)
Mutual labels:  netcore
NetCore8583
NetCore8583 is a library that helps parse/read and generate ISO 8583 messages for .NET Core
Stars: ✭ 24 (+60%)
Mutual labels:  netcore
NetCoreWithDocker
Tutorial with samples about how to setup .Net Core with Docker
Stars: ✭ 20 (+33.33%)
Mutual labels:  netcore
X.Extensions.Logging.Telegram
Telegram logging provider
Stars: ✭ 32 (+113.33%)
Mutual labels:  netcore
EcommerceDDD
Experimental full-stack application using Domain-Driven Design, CQRS, and Event Sourcing.
Stars: ✭ 178 (+1086.67%)
Mutual labels:  netcore
Norm.net
High performance micro-ORM modern Dapper replacement for .NET Standard 2.1 and higher
Stars: ✭ 92 (+513.33%)
Mutual labels:  netcore
protego
A pure-Python robots.txt parser with support for modern conventions.
Stars: ✭ 36 (+140%)
Mutual labels:  robots-txt
MQTTnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 3,309 (+21960%)
Mutual labels:  netcore
robots.txt
🤖 robots.txt as a service. Crawls robots.txt files, downloads and parses them to check rules through an API
Stars: ✭ 13 (-13.33%)
Mutual labels:  robots-txt
XAF Security E4908
This repository contains examples for Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM
Stars: ✭ 47 (+213.33%)
Mutual labels:  netcore
notification-provider
A Mail Notification Library providing additional features on top of existing Email Notification clients like Microsoft Graph, Direct Send, and more!
Stars: ✭ 19 (+26.67%)
Mutual labels:  netcore
Zilon Roguelike
Survival roguelike game with huge world generation.
Stars: ✭ 18 (+20%)
Mutual labels:  netcore
command-core
The MVC library of CLI development
Stars: ✭ 77 (+413.33%)
Mutual labels:  netcore
Chords.py
Neural networks applied in recognizing guitar chords using python, AutoML.NET with C# and .NET Core
Stars: ✭ 24 (+60%)
Mutual labels:  netcore
NETProvider
Firebird ADO.NET Data Provider
Stars: ✭ 113 (+653.33%)
Mutual labels:  netcore
Dazinator.Extensions.FileProviders
No description or website provided.
Stars: ✭ 34 (+126.67%)
Mutual labels:  netcore

Robotify.AspNetCore Robotify.AspNetCore

Robotify - robots.txt middleware for .NET core (.netstandard2.0)

Installation

Install package via NuGet:

Install-Package Robotify.AspNetCore

Configuration

Add Robotify to the middleware pipeline like any other:

Add to the ConfigureServices method to ensure the middleware and configuration are added to the services collection

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddOptions();

            services.AddRobotify();

            services.AddMvc();
        }

To configure what robots directives you want to appear in your robots file you can create and assign a IRobotifyRobotGroupProvider. Multiple providers can be created and registered in the standard DI container, each provider will then be iterated when generating the contents of the robots file.

A IRobotifyRobotGroupProvider contains a single method that returns a list of RobotGroup, below is an example of the RobotifyDisallowAllRobotGroupProvider:

    public class YourOwnProvider : IRobotifyRobotGroupProvider
    {
        public IEnumerable<RobotGroup> Get()
        {
            yield return new RobotGroup() 
			{			
				UserAgent = "something",
				Disallow = new[] { "/" }
			}
        }
    }

To register a provider, use the .AddRobotGroupProvider<TProvider>() extension method when adding robotify:

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRobotify(c => c
                .AddDisallowAllRobotGroupProvider()
                .AddRobotGroupsFromAppSettings()
                .AddRobotGroupProvider<YourOwnProvider>()
            );
        }

Then use the middleware as part of the request pipeline, I would suggest adding it at least after the .UseStaticFiles() middleware, then if you have a static file robots.txt this will be used instead.

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseStaticFiles();
            app.UseRobotify();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }

Robotify can be configured within the .UseRobotify() method or via json configuration:

{
  "Robotify": {
    "Enabled": true,
    "SitemapUrl": "https://www.example.com/sitemap.xml",
    "CrawlDelay": 10,
    "Groups": [
      {
        "UserAgent": "*",
        "Disallow": "/"
      },
      {
        "UserAgent": "Googlebot",
        "Disallow": ["/admin"]
      },
      {
        "UserAgent": "AnotherBot",
        "Allow": ["/search"]
      }
    ]
  }
}

Json configuration and code configuration will be merged at boot time. If no groups are specified a default deny all ill be added.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].