From a5bf29c00b85358f5cc078422871aa6654866d0c Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Wed, 14 Jun 2023 07:45:14 +0300 Subject: Add robots.txt generator --- Services/IRobotsTxtGenerator.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Services/IRobotsTxtGenerator.cs (limited to 'Services') diff --git a/Services/IRobotsTxtGenerator.cs b/Services/IRobotsTxtGenerator.cs new file mode 100644 index 0000000..a238a8e --- /dev/null +++ b/Services/IRobotsTxtGenerator.cs @@ -0,0 +1,21 @@ +using System.Text; + +namespace MyDarling.Controllers; + +public interface IRobotsTxtGenerator +{ + public string GetRobotsText(); +} + +public class RobotsTxtGenerator : IRobotsTxtGenerator +{ + public string GetRobotsText() + { + StringBuilder stringBuilder = new(); + stringBuilder.AppendLine("user-agent: *"); + stringBuilder.AppendLine("disallow: /freedom"); + stringBuilder.AppendLine("disallow: /Account/"); + + return stringBuilder.ToString(); + } +} -- cgit v1.2.3