robotify-netcore icon indicating copy to clipboard operation
robotify-netcore copied to clipboard

Setup sitemap without appsettings.json

Open imclint21 opened this issue 6 years ago • 3 comments

Hi,

How is possible to setup the sitemap link without JSON ?

THanks

imclint21 avatar Jul 21 '19 11:07 imclint21

Hi,

You can configure you own implementation by creating a class that derives from IRobotifyRobotGroupProvider. Then add this during configuration. The reasons contains an example of this

Philo avatar Jul 21 '19 15:07 Philo

Hey,

I've this for now, and I don't really see how to setup sitemap link ^^

namespace Librum
{
    public class RobotsProvider : IRobotifyRobotGroupProvider
    {
        public IEnumerable<RobotGroup> Get()
        {
            yield return new RobotGroup()
            {
                UserAgent = "*",
                Disallow = new[] { "/account", "/saved-articles", "/search" }
            };
        }
    }
}

imclint21 avatar Jul 21 '19 17:07 imclint21

Hi @clintnetwork - apologies for the super late reply here. There is a documentation issue here are you are able to configure the sitemap url via the .UseRobotify() extension:

            app.UseRobotify(c => c
                .Enabled(true)
                .WithSitemap(new Uri("https://www.example.com/sitemap.xml"))
                .DisableFileHeaderComments()
                .WithCrawlDelay(delayInSeconds: 10)
            );

See https://github.com/stormid/robotify-netcore/blob/master/sample/Robotify.AspNetCore.Sample/Startup.cs#L32

Philo avatar Oct 16 '19 10:10 Philo