0
0

Compare commits

...

8 Commits

Author SHA1 Message Date
Sergey Chebotar
57f7cb28a5 Move RobotsTxtGenerator class to separate file 2023-06-14 08:03:29 +03:00
Sergey Chebotar
fc5c75131c Edit robots.txt 2023-06-14 08:02:48 +03:00
Sergey Chebotar
a62845291a Edit docker compose file 2023-06-14 08:02:34 +03:00
Sergey Chebotar
a5bf29c00b Add robots.txt generator 2023-06-14 07:45:14 +03:00
Sergey Chebotar
afdaabce8f Add content and databases to dockerignore 2023-06-13 08:59:22 +03:00
Sergey Chebotar
771b921638 Add stettings.json 2023-06-13 07:40:53 +03:00
Sergey Chebotar
6ac6cf007e Add meta description 2023-06-09 09:39:04 +03:00
Sergey Chebotar
ea585b0eda Add .ico favicon 2023-06-08 09:05:46 +03:00
8 changed files with 43 additions and 6 deletions

View File

@ -2,6 +2,7 @@
**/bin/
**/obj/
**/out/
**/wwwroot/Content
# files
Dockerfile*
@ -9,4 +10,5 @@ Dockerfile*
**/*.md
**/*.ps1
**/*.cmd
**/*.sh
**/*.sh
**/Database/*.db

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "MyDarling.sln"
}

View File

@ -4,14 +4,16 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="description" content="Нижнее бельё ручной работы по вашим индивидуальным меркам.
Сошьём бельё мечты по вашим меркам за 4-7 дней. Находимся в Новороссийске. Доставляем по городу и РФ." />
<meta name="author" content="Екатерина Мануйлова" />
<meta property="og:title" content="My Darling Underwear" />
<meta property="og:url" content="https://mydarlingunderwear.ru/" />
<meta property="og:description" content="Нижнее бельё ручной работы по вашим индивидуальным меркам" />
<meta property="og:image" content="https://mydarlingunderwear.ru/assets/img/bg-signup.jpg" />
<title>My Darling Underwear - нижнее бельё ручной работы</title>
<link rel="shortcut icon" type="image/png" href="/assets/favicon.png" />
<link rel="shortcut icon" type="image/x-icon" href="/assets/favicon.ico" />
<script src="/lib/font-awesome/js/all.js"></script>
<link href="/lib/fancyapps-ui/fancybox.css" rel="stylesheet" />
<link href="/css/styles.css" rel="stylesheet" />

View File

@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore;
using MyDarling.Models;
using MyDarling.Services;
using Microsoft.AspNetCore.Identity;
using MyDarling.Controllers;
var builder = WebApplication.CreateBuilder(args);
@ -28,6 +28,7 @@ builder.Services.Configure<IdentityOptions>( opts =>
});
builder.Services.AddTransient<IImageResizer, ImageResizer>();
builder.Services.AddScoped<IRobotsTxtGenerator, RobotsTxtGenerator>();
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();
@ -38,6 +39,10 @@ app.MapControllers();
app.MapDefaultControllerRoute();
app.MapRazorPages();
var robotsScope = app.Services.CreateScope();
var robotsGenerator = robotsScope.ServiceProvider.GetService<IRobotsTxtGenerator>();
app.MapGet("/robots.txt", () => robotsGenerator!.GetRobotsText());
app.UseAuthentication();
app.UseAuthorization();
IdentitySeedData.CreateAdminAccount(app.Services, app.Configuration);

17
RobotsTxtGenerator.cs Normal file
View File

@ -0,0 +1,17 @@
using System.Text;
namespace MyDarling.Controllers;
public class RobotsTxtGenerator : IRobotsTxtGenerator
{
public string GetRobotsText()
{
StringBuilder stringBuilder = new();
stringBuilder.AppendLine("user-agent: *");
stringBuilder.AppendLine("Disallow: /freedom");
stringBuilder.AppendLine("Disallow: /Account/");
stringBuilder.AppendLine("Disallow: /account/");
return stringBuilder.ToString();
}
}

View File

@ -0,0 +1,8 @@
using System.Text;
namespace MyDarling.Controllers;
public interface IRobotsTxtGenerator
{
public string GetRobotsText();
}

View File

@ -2,13 +2,13 @@ version: '3'
services:
my-darling:
build: .
image: gitea.cebotari.ru/chebser/mydarling-dotnet:latest
container_name: mydarling-dotnet
ports:
- "5050:5000"
volumes:
- db:/app/Database
- content:/app/wwwroot/content
- content:/app/wwwroot/Content
environment:
- ADMIN_PASSWORD=He110World!

BIN
wwwroot/assets/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB