btcpayserver/BTCPayServer/Views/Shared/Header.cshtml
Dennis Reimann 8420c74b31
Improve static asset caching
Cache static assets for one year and set the correct cache control header. Adds the cache busting version based on file content to asset references to invalidate the cache on change. ([further details on the approach](https://andrewlock.net/adding-cache-control-headers-to-static-files-in-asp-net-core/) and [why one year](https://ashton.codes/set-cache-control-max-age-1-year/))

Most of the changes are the additions of the `asp-append-version="true"` attribute, the main configuration change is in `Startup.cs`.
2020-04-18 17:56:05 +02:00

24 lines
1.2 KiB
Plaintext

@inject BTCPayServer.HostedServices.CssThemeManager themeManager
@addTagHelper *, BundlerMinifier.TagHelpers
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="">
<meta name="author" content="">
@if (themeManager.DiscourageSearchEngines)
{
<meta name="robots" content="noindex">
}
<title>@ViewData["Title"]</title>
@* CSS *@
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.BootstrapUri)" rel="stylesheet" asp-append-version="true" />
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.CreativeStartUri)" rel="stylesheet" asp-append-version="true" />
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.ThemeUri)" rel="stylesheet" asp-append-version="true" />
@if (!String.IsNullOrWhiteSpace(themeManager.CustomThemeUri))
{
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.CustomThemeUri)" rel="stylesheet" asp-append-version="true" />
}
<bundle name="wwwroot/bundles/main-bundle.min.css" asp-append-version="true" />
@* JS *@
<bundle name="wwwroot/bundles/main-bundle.min.js" asp-append-version="true" />