page: render breadbrumbs if parent page is specified
This commit is contained in:
parent
6e665d3f52
commit
a0c527078c
@ -53,16 +53,31 @@ class MainHandler extends request_handler {
|
||||
else if ($page->shortName == 'notes')
|
||||
set_skin_opts(['head_section' => $page->shortName]);
|
||||
|
||||
$bc = null;
|
||||
if ($page) {
|
||||
add_meta([
|
||||
'$url' => 'https://'.$config['domain'].$page->getUrl(),
|
||||
'$title' => $page->title,
|
||||
]);
|
||||
|
||||
if ($page->parentId) {
|
||||
$bc = [];
|
||||
$parent = $page;
|
||||
while ($parent?->parentId) {
|
||||
$parent = pages::getById($parent->parentId);
|
||||
if ($parent)
|
||||
$bc[] = ['url' => $parent->getUrl(), 'text' => $parent->title];
|
||||
}
|
||||
if (empty($bc))
|
||||
$bc = null;
|
||||
}
|
||||
}
|
||||
|
||||
set_title($page ? $page->title : '???');
|
||||
render('main/page',
|
||||
unsafe_html: $page->getHtml(is_retina(), getUserTheme()),
|
||||
page_url: $page->getUrl(),
|
||||
bc: $bc,
|
||||
short_name: $page->shortName);
|
||||
|
||||
not_found();
|
||||
|
@ -316,7 +316,7 @@ body.wide .blog-post {
|
||||
h1 {
|
||||
margin: 35px 0 16px;
|
||||
font-weight: 600;
|
||||
font-size: 25px;
|
||||
font-size: 22px;
|
||||
border-bottom: 1px $border-color solid;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
@ -324,14 +324,14 @@ body.wide .blog-post {
|
||||
h2 {
|
||||
margin: 35px 0 16px;
|
||||
font-weight: 500;
|
||||
font-size: 25px;
|
||||
font-size: 22px;
|
||||
border-bottom: 1px $border-color solid;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 27px 0 16px;
|
||||
font-size: 24px;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
@ -159,9 +159,10 @@ function articles_right_link($ctx, $url, string $label, int $index) {
|
||||
// any page
|
||||
// --------
|
||||
|
||||
function page($ctx, $page_url, $short_name, $unsafe_html) {
|
||||
function page($ctx, $page_url, $short_name, $unsafe_html, $bc) {
|
||||
$html = <<<HTML
|
||||
<div class="page">
|
||||
{$ctx->if_true($bc, fn() => $ctx->bc($bc))}
|
||||
{$ctx->if_admin($ctx->page_admin_links, $page_url, $short_name)}
|
||||
<div class="blog-post-text">{$unsafe_html}</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user