1
0
mirror of https://github.com/typemill/typemill.git synced 2025-07-30 10:50:17 +02:00

fix 404.twig with pagedata

This commit is contained in:
trendschau
2025-02-16 13:29:56 +01:00
parent 15e061b448
commit 03bd5bd385
5 changed files with 41 additions and 35 deletions

2
cache/timer.yaml vendored
View File

@@ -1 +1 @@
licenseupdate: 1739702338
licenseupdate: 1739705963

View File

@@ -42,6 +42,16 @@ class ControllerWebFrontend extends Controller
}
$fullUrl = $urlinfo['baseurl'] . $url;
$pagedata = [
'home' => $home,
'title' => 'Page not found',
'description' => 'Sorry, but we did not find the page you where looking for.',
'settings' => $this->settings,
'base_url' => $urlinfo['baseurl'],
'logo' => false,
'favicon' => false,
];
# FIND THE PAGE/ITEM IN NAVIGATION
if($url == '/')
@@ -56,10 +66,7 @@ class ControllerWebFrontend extends Controller
if(!$pageinfo)
{
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
'title' => 'Page not found',
'description' => 'We did not find the page you where looking for.'
]);
return $this->c->get('view')->render($response->withStatus(404), '404.twig', $pagedata);
}
$keyPathArray = explode(".", $pageinfo['keyPath']);
@@ -68,10 +75,7 @@ class ControllerWebFrontend extends Controller
if(!$item)
{
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
'title' => 'Page not found',
'description' => 'We did not find the page you where looking for.'
]);
return $this->c->get('view')->render($response->withStatus(404), '404.twig', $pagedata);
}
}
@@ -86,10 +90,7 @@ class ControllerWebFrontend extends Controller
{
if($page->status == 'unpublished')
{
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
'title' => 'Page not found',
'description' => 'We did not find the page you where looking for.'
]);
return $this->c->get('view')->render($response->withStatus(404), '404.twig', $pagedata);
}
}
}
@@ -159,10 +160,7 @@ class ControllerWebFrontend extends Controller
$refpageinfo = $navigation->getPageInfoForUrl($metadata['meta']['reference'], $urlinfo, $langattr);
if(!$refpageinfo)
{
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
'title' => 'Referenced page not found',
'description' => 'We did not find the page that has been referenced. Please inform the website owner to fix it in meta reference.'
]);
return $this->c->get('view')->render($response->withStatus(404), '404.twig', $pagedata);
}
$refKeyPathArray = explode(".", $refpageinfo['keyPath']);

View File

@@ -392,11 +392,11 @@ $errorMiddleware = new ErrorMiddleware(
);
# Set the Not Found Handler
$errorMiddleware->setErrorHandler(HttpNotFoundException::class, function ($request, $exception) use ($container) {
$response = new NewResponse();
$errorMiddleware->setErrorHandler(HttpNotFoundException::class, function ($request, $exception) use ($container) {
return $container->get('view')->render($response->withStatus(404), '404.twig');
$response = new NewResponse();
return $container->get('view')->render($response->withStatus(404), '404.twig', $pagedata);
});

View File

@@ -4,21 +4,32 @@
{% block content %}
<section class="w-100 dib tc bt bl br bb">
<section class="landingpageinfo vh-100 dt w-100 tc bt bl br bb">
<div class="mw7 pb7 ph3 center">
<header class="mt6">
<h1 class="f-large f-headline-ns lh-title mv2 pt5-ns">Not Found</h1>
</header>
<div class="cover dtc v-mid bg-left bg-center-l">
<div class="mw7 ph3 center">
<div class="introbg pa4">
<header>
<h1 class="f-large f-headline-ns lh-title mv2 pt5-ns">{{title}}</h1>
</header>
<div class="f5 f4-ns fw3 lh-copy">
<p>{{description}}</p>
<a class="button link dim ph4 pv3 mt3 dib" href="{{ base_url }}">Return to the homepage</a>
</div>
</div>
<div class="f5 f4-ns fw3 lh-copy">
<p>Sorry, but we did not find the page that you are looking for.</p>
</div>
<a class="button link dim ph4 pv3 mt3 dib" href="{{ base_url }}">Home</a>
</div>
</div>
</section>
{% endblock %}

View File

@@ -214,9 +214,6 @@
{% block javascripts %}
{{ assets.renderCSS() }}
<script src="{{ base_url }}/system/typemill/author/js/typemillutils.js?20220108"></script>
<script>typemillUtilities.start();</script>
{% if settings.themes.cyanine.collapseNav %}
<script>