139 lines
7.8 KiB
Plaintext
139 lines
7.8 KiB
Plaintext
@using System.Security.Claims
|
|
@inject IConfiguration Configuration
|
|
@inject PlotLine.Data.IAppearanceRepository AppearancePreferences
|
|
@{
|
|
var isAuthentication = string.Equals(ViewContext.RouteData.Values["controller"]?.ToString(), "Account", StringComparison.OrdinalIgnoreCase);
|
|
string? accountTheme = null;
|
|
if (isAuthentication && User.Identity?.IsAuthenticated == true && int.TryParse(User.FindFirstValue(ClaimTypes.NameIdentifier), out var accountUserId))
|
|
{
|
|
accountTheme = (await AppearancePreferences.GetAsync(accountUserId)).ThemeKey;
|
|
}
|
|
var seoMetadata = ViewData["Seo"] as SeoMetadata;
|
|
var defaultTitle = PublicSeo.DisplayTitle(ViewData["Title"] as string);
|
|
var seoTitle = ViewData["SeoTitle"] is string seoTitleValue ? seoTitleValue : defaultTitle;
|
|
var hasSeoMetadata = seoMetadata is not null || ViewData["SeoDescription"] is string || ViewData["CanonicalUrl"] is string;
|
|
var seoDescription = ViewData["SeoDescription"] as string;
|
|
var canonicalUrl = ViewData["CanonicalUrl"] as string;
|
|
var seoKeywords = ViewData["SeoKeywords"] as string;
|
|
var structuredData = ViewData["StructuredData"] is IEnumerable<string> structuredDataValues ? structuredDataValues : Array.Empty<string>();
|
|
var ogTitle = ViewData["OgTitle"] as string ?? seoTitle;
|
|
var ogDescription = ViewData["OgDescription"] as string ?? seoDescription;
|
|
var ogType = ViewData["OgType"] as string ?? "website";
|
|
var ogImageUrl = ViewData["OgImage"] as string ?? PublicSeo.AbsoluteUrl(Configuration, PublicSeo.DefaultOgImagePath);
|
|
var twitterCard = ViewData["TwitterCard"] as string ?? "summary_large_image";
|
|
}
|
|
<!DOCTYPE html>
|
|
<html lang="en-GB" data-theme="light" data-bs-theme="light" data-site-theme="public">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>@seoTitle</title>
|
|
@if (hasSeoMetadata)
|
|
{
|
|
@if (!string.IsNullOrWhiteSpace(seoDescription))
|
|
{
|
|
<meta name="description" content="@seoDescription" />
|
|
}
|
|
@if (!string.IsNullOrWhiteSpace(seoKeywords))
|
|
{
|
|
<meta name="keywords" content="@seoKeywords" />
|
|
}
|
|
<meta name="robots" content="@(ViewData["Robots"] as string ?? "index, follow")" />
|
|
<meta property="og:site_name" content="PlotDirector" />
|
|
<meta property="og:title" content="@ogTitle" />
|
|
@if (!string.IsNullOrWhiteSpace(ogDescription))
|
|
{
|
|
<meta property="og:description" content="@ogDescription" />
|
|
}
|
|
<meta property="og:type" content="@ogType" />
|
|
@if (!string.IsNullOrWhiteSpace(canonicalUrl))
|
|
{
|
|
<meta property="og:url" content="@canonicalUrl" />
|
|
}
|
|
<meta property="og:image" content="@ogImageUrl" />
|
|
<meta name="twitter:card" content="@twitterCard" />
|
|
<meta name="twitter:title" content="@ogTitle" />
|
|
@if (!string.IsNullOrWhiteSpace(ogDescription))
|
|
{
|
|
<meta name="twitter:description" content="@ogDescription" />
|
|
}
|
|
<meta name="twitter:image" content="@ogImageUrl" />
|
|
}
|
|
@foreach (var jsonLd in structuredData)
|
|
{
|
|
@Html.Raw("<script type=\"application/ld+json\">")
|
|
@Html.Raw(jsonLd)
|
|
@Html.Raw("</script>")
|
|
}
|
|
@if (!string.IsNullOrWhiteSpace(canonicalUrl))
|
|
{
|
|
<link rel="canonical" href="@canonicalUrl" />
|
|
}
|
|
|
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
|
<link rel="stylesheet" href="~/css/public-site.css" asp-append-version="true" />
|
|
<link rel="stylesheet" href="~/css/public-art-direction.css" asp-append-version="true" />
|
|
<link rel="stylesheet" href="~/css/writing-solver.css" asp-append-version="true" />
|
|
<link rel="icon" href="~/favicon.svg" type="image/svg+xml" />
|
|
<meta name="theme-color" content="#f8f5ee" />
|
|
@if (isAuthentication)
|
|
{
|
|
<link id="public-auth-base" rel="stylesheet" href="~/css/plotline-theme.css" asp-append-version="true" media="not all" />
|
|
<link rel="manifest" href="~/site.webmanifest" />
|
|
<link rel="stylesheet" href="~/css/application-shell.css" asp-append-version="true" />
|
|
<script src="~/js/application-display-mode.js" asp-append-version="true"></script>
|
|
<script>window.plotdirectorAuthTheme = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(accountTheme));</script>
|
|
<script src="~/js/public-auth-theme.js" asp-append-version="true"></script>
|
|
}
|
|
</head>
|
|
<body class="public-site @(isAuthentication ? "public-auth" : "")">
|
|
<a class="public-skip" href="#main-content">Skip to content</a>
|
|
<header class="public-header">
|
|
<nav class="navbar navbar-expand-md public-nav" aria-label="Main navigation">
|
|
<div class="marketing-container">
|
|
<a class="public-wordmark" asp-route="@PublicRouteNames.Home"><span class="public-logo-mark" aria-hidden="true">p<span>.</span></span>PlotDirector</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#publicMenu" aria-controls="publicMenu" aria-expanded="false" aria-label="Open navigation"><span class="navbar-toggler-icon"></span></button>
|
|
<div class="collapse navbar-collapse" id="publicMenu">
|
|
<div class="public-links">
|
|
<a asp-route="@PublicRouteNames.Home">Home</a>
|
|
<a asp-route="@PublicRouteNames.Features">Tour</a>
|
|
<a href="/writing-problems">Writing Solver</a>
|
|
<a asp-route="@PublicRouteNames.Pricing">Pricing</a>
|
|
<a asp-route="@PublicRouteNames.Help">Help</a>
|
|
</div>
|
|
<div class="public-account">
|
|
@if (User.Identity?.IsAuthenticated == true)
|
|
{
|
|
<a asp-controller="Projects" asp-action="Index">Your workspace <span aria-hidden="true">↗</span></a>
|
|
}
|
|
else
|
|
{
|
|
<a asp-controller="Account" asp-action="Login">Sign in</a>
|
|
<a class="marketing-btn marketing-btn--primary" asp-controller="Account" asp-action="Register">Start writing <span aria-hidden="true">↗</span></a>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
<main id="main-content" class="@(isAuthentication ? "public-auth-main" : "marketing-shell")" tabindex="-1">
|
|
@RenderBody()
|
|
</main>
|
|
<footer class="public-footer">
|
|
<div class="marketing-container">
|
|
<div class="public-footer-top"><a class="public-wordmark" asp-route="@PublicRouteNames.Home">PlotDirector<span class="gold-dot">.</span></a><p>Your book. Your words.<br />A little less to keep in your head.</p></div>
|
|
<nav class="public-footer__nav" aria-label="Footer navigation">
|
|
<a asp-route="@PublicRouteNames.Features">Tour</a>
|
|
<a href="/writing-problems">Writing Solver</a><a asp-route="@PublicRouteNames.Pricing">Pricing</a><a asp-route="@PublicRouteNames.Help">Help</a><a asp-route="@PublicRouteNames.About">Our story</a><a asp-route="@PublicRouteNames.Contact">Contact</a><a asp-route="@PublicRouteNames.Privacy">Privacy</a><a asp-route="@PublicRouteNames.Terms">Terms</a>
|
|
</nav>
|
|
<p class="public-colophon">© @DateTime.UtcNow.Year PlotDirector. For the stories only you can tell.</p>
|
|
</div>
|
|
</footer>
|
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
|
@await RenderSectionAsync("Scripts", required: false)
|
|
</body>
|
|
</html>
|