mirror of
https://github.com/yawaflua/yaflay.ru.git
synced 2026-02-04 19:04:12 +02:00
Add 404 page
Some rework Robots.txt BugFixes controllers
This commit is contained in:
@@ -39,7 +39,7 @@ namespace yaflay.ru.Новая_папка
|
|||||||
|
|
||||||
string? url = await getUrlFromGit(uri);
|
string? url = await getUrlFromGit(uri);
|
||||||
await Console.Out.WriteLineAsync(url == null ? "Null" : $"notNull {url}");
|
await Console.Out.WriteLineAsync(url == null ? "Null" : $"notNull {url}");
|
||||||
return Redirect(url ?? "https://yaflay.ru/");
|
return Redirect(url ?? "https://yaflay.ru/404");
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: HomeController/Create
|
// GET: HomeController/Create
|
||||||
|
|||||||
32
Pages/ErrorPage.cshtml
Normal file
32
Pages/ErrorPage.cshtml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
@page
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Page not found</title>
|
||||||
|
<link rel="shortcut icon" type="image/png" href="#">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" />
|
||||||
|
<link rel="stylesheet" href="~/css/404.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
@{
|
||||||
|
string path = $"{this.Request.Scheme}://{this.Request.Host}";
|
||||||
|
}
|
||||||
|
<div class="error">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-7 text-center">
|
||||||
|
<img src="~/img/error-404.png" alt="image 404">
|
||||||
|
<h2><b>404</b> Страница не найдена</h2>
|
||||||
|
<p>посетите главную страницу <br> возможно вы найдёте её</p>
|
||||||
|
<a href="@path" class="cmn-btn mt-4">На главную</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
12
Pages/ErrorPage.cshtml.cs
Normal file
12
Pages/ErrorPage.cshtml.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace yaflay.ru.Pages
|
||||||
|
{
|
||||||
|
public class Index1Model : PageModel
|
||||||
|
{
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
Layout = null;
|
Layout = null;
|
||||||
this.Response.ContentType = "text/plain";
|
this.Response.ContentType = "text/plain";
|
||||||
}
|
}
|
||||||
# /robots.txt file for http://www.hanselman.com/
|
# /Robots.txt file for httpы://yaflay.com/
|
||||||
User-agent: *
|
User-agent: *
|
||||||
<environment include="Development,Staging">Disallow: /</environment>
|
<environment include="Development,Staging">Disallow: /</environment>
|
||||||
<environment include="Production">Disallow: /* </environment>
|
<environment include="Production">Disallow: /* </environment>
|
||||||
10
Startup.cs
10
Startup.cs
@@ -14,13 +14,19 @@ namespace yaflay.ru
|
|||||||
}
|
}
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddControllers();
|
services.AddControllers()
|
||||||
|
.AddRazorPagesOptions(options =>
|
||||||
|
{
|
||||||
|
options.Conventions.AddPageRoute("/RobotsTxt", "/Robots.txt");
|
||||||
|
options.Conventions.AddPageRoute("/ErrorPage", "/404");
|
||||||
|
});
|
||||||
services.AddRouting();
|
services.AddRouting();
|
||||||
services.AddRazorPages();
|
services.AddRazorPages();
|
||||||
services.AddMvc()
|
services.AddMvc()
|
||||||
.AddRazorPagesOptions(options =>
|
.AddRazorPagesOptions(options =>
|
||||||
{
|
{
|
||||||
options.Conventions.AddPageRoute("/robots.txt", "/RobotsTxt");
|
options.Conventions.AddPageRoute("/RobotsTxt", "/Robots.txt");
|
||||||
|
options.Conventions.AddPageRoute("/ErrorPage", "/404");
|
||||||
});
|
});
|
||||||
//services.AddDirectoryBrowser();
|
//services.AddDirectoryBrowser();
|
||||||
|
|
||||||
|
|||||||
162
wwwroot/css/404.css
Normal file
162
wwwroot/css/404.css
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&family=Roboto&family=Playfair+Display&display=swap");
|
||||||
|
|
||||||
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
color: #6f6f6f;
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 400;
|
||||||
|
position: relative;
|
||||||
|
line-height: 1.7;
|
||||||
|
background-color: #f8f6ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 62px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 991px) {
|
||||||
|
h2 {
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 575px) {
|
||||||
|
h2 {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
h4 {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
h5 {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
font-family: "Poppins", sans-serif;
|
||||||
|
color: #525252;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 > a,
|
||||||
|
h2 > a,
|
||||||
|
h3 > a,
|
||||||
|
h4 > a,
|
||||||
|
h5 > a,
|
||||||
|
h6 > a {
|
||||||
|
font-family: "Poppins", sans-serif;
|
||||||
|
color: #525252;
|
||||||
|
font-weight: 600;
|
||||||
|
-webkit-transition: all 0.3s;
|
||||||
|
-o-transition: all 0.3s;
|
||||||
|
transition: all 0.3s;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
p,
|
||||||
|
li,
|
||||||
|
span {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmn-btn {
|
||||||
|
padding: 12px 35px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-ms-border-radius: 5px;
|
||||||
|
-o-border-radius: 5px;
|
||||||
|
background-color: #6e41ff;
|
||||||
|
box-shadow: 0px 10px 20px 0px rgba(0, 0, 0, 0.15);
|
||||||
|
-webkit-transition: all 0.3s;
|
||||||
|
-o-transition: all 0.3s;
|
||||||
|
transition: all 0.3s;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmn-btn:hover {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #5b28ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
position: relative;
|
||||||
|
padding: 120px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error .title {
|
||||||
|
font-size: 42px;
|
||||||
|
margin-top: 30px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.error .title {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.error .title b {
|
||||||
|
font-size: 72px;
|
||||||
|
color: #f45570;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error p {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
BIN
wwwroot/img/error-404.png
Normal file
BIN
wwwroot/img/error-404.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Reference in New Issue
Block a user