Views and controller for robots.txt file with DXA .NET
namespace My.Example
{
using System;
[CoreSemanticEntity("SeoRobotsTxtSettings")]
public class SeoRobotsTxtSettings : EntityModel
{
public string Rules { get; set; }
}
}
# this is the region view (rename this to robots.cshtml)
@model RegionModel
@Html.DxaEntities()
# this is the page view (rename this to robots.cshtml)
@model PageModel
@Html.DxaRegion("RobotsTxt")
@{
Layout = "";
Response.ContentType = "text/plain";
}
# this is the enity model (rename this to robots.cshtml)
@model SeoRobotsTxtSettings
@Model.Rules
Sitemap: link to your sitemap here