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) {
navbar.innerHTML = data.Navigation;
}
if (data.Title) {
document.title = data.PageTitle;
}
if (data.Page) {
pageArea.innerHTML = data.Page;

@ -109,10 +109,18 @@ function renderPage($page_name = null, $site_name = null): array
$page = "";
}
if(!empty($pageMetadata["parameters"]["page_title"])){
$page_title = $pageMetadata["parameters"]["page_title"];
}
else{
$page_title = $page_name;
}
return [
"PageContent" => $page,
"PageName" => $page_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");
if(!empty($pageMetadata["parameters"]["page_title"])){
$page_title = $pageMetadata["parameters"]["page_title"];
}
else{
$page_title = $page_name;
}
$page_title = $page_tmp["PageTitle"];
$dynamic_style = doDynamicStyling();
$dynamic_script_data = [
"currentPage" => $page_name,