Add model alias for payload (#47)

- Update post/page canonical URLs for Fluid
This commit is contained in:
2025-07-05 16:48:15 -04:00
parent ba5e27e011
commit 1f7d415868
3 changed files with 16 additions and 10 deletions
+4 -3
View File
@@ -69,7 +69,8 @@ open Giraffe.Htmx
open Giraffe.ViewEngine
/// htmx script tag
let private htmxScript = RenderView.AsString.htmlNode Htmx.Script.minified
let private htmxScript (webLog: WebLog) =
$"""<script src="{webLog.RelativeUrl(Permalink "htmx.min.js")}"></script>"""
/// Get the current user messages, and commit the session so that they are preserved
let private getCurrentMessages ctx = task {
@@ -91,7 +92,7 @@ let private generateViewContext messages viewCtx (ctx: HttpContext) =
CurrentPage = ctx.Request.Path.Value[1..]
Messages = messages
Generator = ctx.Generator
HtmxScript = htmxScript
HtmxScript = htmxScript ctx.WebLog
IsAuthor = ctx.HasAccessLevel Author
IsEditor = ctx.HasAccessLevel Editor
IsWebLogAdmin = ctx.HasAccessLevel WebLogAdmin
@@ -188,7 +189,7 @@ let viewForTheme themeId template next ctx (viewCtx: AppViewContext) = task {
let forLayout = { updated with Content = Template.render contentTemplate updated ctx.Data }
// ...then render that content with its layout
match! Template.Cache.get themeId (if isHtmx ctx then "layout-partial" else "layout") ctx.Data with
| Ok layoutTemplate -> return! htmlString (Template.render layoutTemplate forLayout ctx.Data) next ctx
| Ok layoutTemplate -> return! htmlString (Template.render layoutTemplate forLayout ctx.Data) next ctx
| Error message -> return! Error.server message next ctx
| Error message -> return! Error.server message next ctx
}