Replace URLs in pages when not at directory root

This commit is contained in:
Daniel J. Summers 2022-05-30 22:33:29 -04:00
parent b971a343a4
commit 5daf18e01d
2 changed files with 5 additions and 2 deletions

View File

@ -93,6 +93,7 @@ type DisplayPage =
/// The metadata for the page
metadata : MetaItem list
}
/// Create a minimal display page (no text or metadata) from a database page
static member fromPageMinimal webLog (page : Page) =
let pageId = PageId.toString page.id
@ -106,8 +107,10 @@ type DisplayPage =
text = ""
metadata = []
}
/// Create a display page from a database page
static member fromPage webLog (page : Page) =
let _, extra = WebLog.hostAndPath webLog
let pageId = PageId.toString page.id
{ id = pageId
title = page.title
@ -116,7 +119,7 @@ type DisplayPage =
updatedOn = page.updatedOn
showInPageList = page.showInPageList
isDefault = pageId = webLog.defaultPage
text = page.text
text = if extra = "" then page.text else page.text.Replace ("href=\"/", $"href=\"{extra}/")
metadata = page.metadata
}

View File

@ -3,7 +3,7 @@
"hostname": "data02.bitbadger.solutions",
"database": "myWebLog_dev"
},
"Generator": "myWebLog 2.0-alpha15",
"Generator": "myWebLog 2.0-alpha16",
"Logging": {
"LogLevel": {
"MyWebLog.Handlers": "Debug"