mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Improved loading times, improved SEO for lighthouse
This commit is contained in:
@@ -48,8 +48,8 @@ builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationSc
|
|||||||
builder.Services.AddResponseCompression(options =>
|
builder.Services.AddResponseCompression(options =>
|
||||||
{
|
{
|
||||||
options.EnableForHttps = true;
|
options.EnableForHttps = true;
|
||||||
options.MimeTypes = new[]
|
options.MimeTypes =
|
||||||
{
|
[
|
||||||
"text/plain",
|
"text/plain",
|
||||||
"text/css",
|
"text/css",
|
||||||
"application/javascript",
|
"application/javascript",
|
||||||
@@ -58,7 +58,7 @@ builder.Services.AddResponseCompression(options =>
|
|||||||
"text/xml",
|
"text/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
"image/svg+xml"
|
"image/svg+xml"
|
||||||
};
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
@@ -89,7 +89,22 @@ if (app.Environment.IsDevelopment())
|
|||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
OnPrepareResponse = ctx =>
|
||||||
|
{
|
||||||
|
string requestPath = ctx.Context.Request.Path.ToString();
|
||||||
|
if (requestPath.EndsWith(".css") || requestPath.EndsWith(".js"))
|
||||||
|
{
|
||||||
|
ctx.Context.Response.GetTypedHeaders().CacheControl =
|
||||||
|
new Microsoft.Net.Http.Headers.CacheControlHeaderValue()
|
||||||
|
{
|
||||||
|
Public = true,
|
||||||
|
MaxAge = TimeSpan.FromDays(365)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseResponseCompression();
|
app.UseResponseCompression();
|
||||||
|
|||||||
@@ -4,15 +4,17 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
<meta name="description" content="Hardware asset management tool" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - Berufsschule_HAM</title>
|
<title>@ViewData["Title"] - Berufsschule_HAM</title>
|
||||||
<script type="importmap"></script>
|
<script type="importmap"></script>
|
||||||
@* <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /> *@
|
@* <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-append-version="true"/> *@
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
|
||||||
crossorigin="anonymous">
|
crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
@* <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" /> *@
|
||||||
|
<link rel="preload" href="~/css/site.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||||
|
<noscript><link rel="stylesheet" href="~/css/site.css"></noscript>
|
||||||
<link rel="stylesheet" href="~/Berufsschule_HAM.styles.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/Berufsschule_HAM.styles.css" asp-append-version="true" />
|
||||||
</head>
|
</head>
|
||||||
<body data-bs-theme="dark">
|
<body data-bs-theme="dark">
|
||||||
@@ -71,10 +73,10 @@
|
|||||||
© 2025 - Berufsschule_HAM
|
© 2025 - Berufsschule_HAM
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
@* <script src="~/lib/jquery/dist/jquery.min.js"></script> *@
|
@* <script src="~/lib/jquery/dist/jquery.min.js" defer></script> *@
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
|
||||||
crossorigin="anonymous" defer></script>
|
crossorigin="anonymous" defer></script>
|
||||||
@* <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script> *@
|
@* <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js" defer></script> *@
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
crossorigin="anonymous" defer></script>
|
crossorigin="anonymous" defer></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true" defer></script>
|
<script src="~/js/site.js" asp-append-version="true" defer></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user