INitial work
This commit is contained in:
40
Pages/Shared/_Layout.cshtml
Normal file
40
Pages/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,40 @@
|
||||
@{
|
||||
var isHtmxRequest = ViewContext.HttpContext.Request.Headers["hx-request"].Any(v => v == "true");
|
||||
var isHtmxHistoryRestoreRequest = ViewContext.HttpContext.Request.Headers["hx-history-restore-request"].Any(v => v == "true");
|
||||
}
|
||||
|
||||
@if (!isHtmxRequest || isHtmxHistoryRestoreRequest)
|
||||
{
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>forget me not</title>
|
||||
|
||||
<link rel="stylesheet" href="~/css/styles.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/ForgetMeNot.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header></header>
|
||||
<main>
|
||||
<h1>The Site is here!</h1>
|
||||
@RenderBody()
|
||||
</main>
|
||||
<footer>
|
||||
<span>header: @ViewContext.HttpContext.Request.Headers["HX-Request"]</span>
|
||||
<button hx-get="/sample" hx-swap="outerHTML">Replace me</button>
|
||||
</footer>
|
||||
|
||||
<script src="https://unpkg.com/htmx.org@1.8.0"></script>
|
||||
<script src="https://unpkg.com/hyperscript.org@0.9.7"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
}
|
||||
else
|
||||
{
|
||||
<text>@RenderBody()</text>
|
||||
}
|
||||
Reference in New Issue
Block a user