diff --git a/src/MyWebLog/Caches.fs b/src/MyWebLog/Caches.fs
index 7e3351e..7de627e 100644
--- a/src/MyWebLog/Caches.fs
+++ b/src/MyWebLog/Caches.fs
@@ -101,10 +101,9 @@ module WebLogCache =
let relUrl = Permalink >> webLog.RelativeUrl
let urlTo = if it.To.Contains "://" then it.To else relUrl it.To
if it.IsRegex then
- let pattern = if it.From.StartsWith "^" then $"^{relUrl it.From[1..]}" else it.From
- RegEx(Regex(pattern, RegexOptions.Compiled ||| RegexOptions.IgnoreCase), urlTo)
+ RegEx(Regex(it.From, RegexOptions.Compiled ||| RegexOptions.IgnoreCase), urlTo)
else
- Text(relUrl it.From, urlTo))
+ Text(it.From, urlTo))
/// Get all cached web logs
/// All cached web logs
diff --git a/src/MyWebLog/Handlers/Post.fs b/src/MyWebLog/Handlers/Post.fs
index bb6efba..559e5ca 100644
--- a/src/MyWebLog/Handlers/Post.fs
+++ b/src/MyWebLog/Handlers/Post.fs
@@ -139,7 +139,7 @@ let pageOfCategorizedPosts slugAndPage : HttpHandler = fun next ctx -> task {
return!
{ viewCtx with
PageTitle = $"{cat.Name}: Category Archive{pgTitle}"
- Subtitle = cat.Description
+ Subtitle = defaultArg cat.Description ""
IsCategory = true
IsCategoryHome = (pageNbr = 1)
Slug = Some slug }
diff --git a/src/MyWebLog/ProgramSupport.fs b/src/MyWebLog/ProgramSupport.fs
index 4c85acf..461f862 100644
--- a/src/MyWebLog/ProgramSupport.fs
+++ b/src/MyWebLog/ProgramSupport.fs
@@ -39,15 +39,15 @@ type RedirectRuleMiddleware(next: RequestDelegate, _log: ILogger List.tryPick (fun rule ->
match rule with
- | WebLogCache.CachedRedirectRule.Text (urlFrom, urlTo) ->
+ | WebLogCache.CachedRedirectRule.Text(urlFrom, urlTo) ->
if ciEquals path urlFrom then Some urlTo else None
- | WebLogCache.CachedRedirectRule.RegEx (regExFrom, patternTo) ->
- if regExFrom.IsMatch path then Some (regExFrom.Replace(path, patternTo)) else None)
+ | WebLogCache.CachedRedirectRule.RegEx(regExFrom, patternTo) ->
+ if regExFrom.IsMatch path then regExFrom.Replace(path, patternTo) |> Some else None)
match matched with
| Some url when url.StartsWith "http" && ctx.Request.IsHtmx ->
do! ctx.Response.WriteAsync $""""""
diff --git a/src/MyWebLog/ViewContext.fs b/src/MyWebLog/ViewContext.fs
index 01699eb..4e04d50 100644
--- a/src/MyWebLog/ViewContext.fs
+++ b/src/MyWebLog/ViewContext.fs
@@ -18,7 +18,7 @@ type AppViewContext = {
PageTitle: string
/// The subtitle for the page
- Subtitle: string option
+ Subtitle: string
/// The anti-Cross Site Request Forgery (CSRF) token set to use when rendering a form
Csrf: AntiforgeryTokenSet option
@@ -94,7 +94,7 @@ type AppViewContext = {
/// The payload for this page as a PostDisplay
member this.Posts =
this.Payload :?> PostDisplay
-
+
/// The model for this view (prior versions used model for the v3 payload)
member this.Model =
this.Payload
@@ -104,7 +104,7 @@ type AppViewContext = {
{ WebLog = WebLog.Empty
UserId = None
PageTitle = ""
- Subtitle = None
+ Subtitle = ""
Csrf = None
PageList = [||]
Categories = [||]
diff --git a/src/MyWebLog/Views/WebLog.fs b/src/MyWebLog/Views/WebLog.fs
index 68cd840..e7a3110 100644
--- a/src/MyWebLog/Views/WebLog.fs
+++ b/src/MyWebLog/Views/WebLog.fs
@@ -453,8 +453,8 @@ let redirectList (model: RedirectRule list) app = [
let ruleDetail idx (rule: RedirectRule) =
let ruleId = $"rule_{idx}"
div [ _class "row mwl-table-detail"; _id ruleId ] [
- div [ _class "col-5 no-wrap" ] [
- txt rule.From; br []
+ div [ _class "col-10" ] [
+ txt rule.From; br []; raw "» "; txt rule.To; br []
small [] [
let ruleUrl = relUrl app $"admin/settings/redirect-rules/{idx}"
a [ _href ruleUrl; _hxBoost; _hxTarget $"#{ruleId}"
@@ -472,7 +472,6 @@ let redirectList (model: RedirectRule list) app = [
]
]
]
- div [ _class "col-5" ] [ txt rule.To ]
div [ _class "col-2 text-center" ] [ yesOrNo rule.IsRegex ]
]
h2 [ _class "my-3" ] [ raw app.PageTitle ]
@@ -496,8 +495,7 @@ let redirectList (model: RedirectRule list) app = [
else
div [ _class "container g-0" ] [
div [ _class "row mwl-table-heading" ] [
- div [ _class "col-5" ] [ raw "From" ]
- div [ _class "col-5" ] [ raw "To" ]
+ div [ _class "col-10" ] [ raw "From » To" ]
div [ _class "col-2 text-center" ] [ raw "RegEx?" ]
]
]
diff --git a/src/default-theme/index.liquid b/src/default-theme/index.liquid
index 1136d0d..0771eda 100644
--- a/src/default-theme/index.liquid
+++ b/src/default-theme/index.liquid
@@ -1,6 +1,6 @@
{%- if is_category or is_tag %}
{{ page_title }}
- {%- if subtitle %}{{ subtitle }}
{% endif -%}
+ {%- if subtitle <> "" %}{{ subtitle }}
{% endif -%}
{% endif %}
{%- assign post_count = model.posts | size -%}
{%- if post_count > 0 %}