HandlerPageView: Add [cmd:pagetitle] to set custom per-page titles

这个提交包含在:
2022-01-23 10:02:46 +01:00
父节点 ca0c8a94fb
当前提交 1d5bf80710
共有 2 个文件被更改,包括 30 次插入20 次删除

查看文件

@@ -167,6 +167,7 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename,
}
}
std::string revisionstr = std::to_string(revision->revision);
std::string customtitle = parser.extractCommand("pagetitle", revision->content);
page.setVar("content", parsedcontent);
page.setVar("index", indexcontent);
page.setVar("editedby", revision->author);
@@ -174,6 +175,10 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename,
page.setVar("historyurl", this->urlProvider->pageHistory(pagename));
page.setVar("revision", revisionstr);
setPageVars(page, pagename);
if(!customtitle.empty())
{
page.setVar("title", createPageTitle(customtitle));
}
std::string body = page.render();
if(revisionid == 0 && !this->userSession->loggedIn)
{