Fix page title

This commit is contained in:
Bruno Rybársky 2024-02-24 09:16:21 +01:00
parent b51f3d9c6f
commit 7798e41e28
2 changed files with 12 additions and 6 deletions

@ -70,6 +70,9 @@ async function handlePageResponse(data) {
if (data.Navigation) { if (data.Navigation) {
navbar.innerHTML = data.Navigation; navbar.innerHTML = data.Navigation;
} }
if (data.Title) {
document.title = data.PageTitle;
}
if (data.Page) { if (data.Page) {
pageArea.innerHTML = data.Page; pageArea.innerHTML = data.Page;

@ -109,10 +109,18 @@ function renderPage($page_name = null, $site_name = null): array
$page = ""; $page = "";
} }
if(!empty($pageMetadata["parameters"]["page_title"])){
$page_title = $pageMetadata["parameters"]["page_title"];
}
else{
$page_title = $page_name;
}
return [ return [
"PageContent" => $page, "PageContent" => $page,
"PageName" => $page_name, "PageName" => $page_name,
"SiteName" => $site_name, "SiteName" => $site_name,
"PageTitle" => $page_title,
]; ];
} }
@ -130,12 +138,7 @@ function getPage($site_name_in = null, $page_name_in = null): string
$footer = file_get_contents($routerConfig["template_dir"] . "footer.html"); $footer = file_get_contents($routerConfig["template_dir"] . "footer.html");
if(!empty($pageMetadata["parameters"]["page_title"])){ $page_title = $page_tmp["PageTitle"];
$page_title = $pageMetadata["parameters"]["page_title"];
}
else{
$page_title = $page_name;
}
$dynamic_style = doDynamicStyling(); $dynamic_style = doDynamicStyling();
$dynamic_script_data = [ $dynamic_script_data = [
"currentPage" => $page_name, "currentPage" => $page_name,