Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status Pages won't display overridden content #535

Open
dedavidson opened this issue Apr 3, 2024 · 1 comment
Open

Status Pages won't display overridden content #535

dedavidson opened this issue Apr 3, 2024 · 1 comment
Assignees

Comments

@dedavidson
Copy link

If status pages are overridden in for example microsites by specific nodes then the templates for page--404.html.twig and page--403.html.twig will not display the content of these nodes as their page_content block overrides the same block from page-status.html.twig.

@chriswales95
Copy link
Member

chriswales95 commented May 22, 2024

Okay, did a deep dive and found a few issues and will open up a MR here and potentially another in localgov_core.

The 403 template, page--403.html.twig, doesn't actually do anything. It extends @localgov_base/layout/page.html.twig but that template doesn't have a block called page_content. That means dynamic content will never load.

The base theme templates hard-code the text in them which makes it difficult to customise the contents. I'd imagine users would like full control over what's there. For example, on the 404 you get dynamic content and the hard-coded text. Drupal's default page content for these pages is quite sparse and unhelpful which is why I imagine the content has been put in these templates.

It's not possible to check if the site has a custom 404 or 403 in the template itself. The page.content variable always has something in it even if it's just Drupal's default content. We can check this by inspecting the sysem.site config but this doens't work as well on Microsites in which each microsite can have it's own system.site config.

Drupal checks for the presence of custom error pages in the event subscriber CustomPageExceptionHtmlSubscriber but the actual content is set in the controller Http4xxController. I sugest we move the hard-coded text into another controller (perhaps we override the Http4xxController in localgov_core).

So my suggestions are:

  1. We remove the hard-coded content from the templates and have them simply extend @localgov_base/layout/status-pages/page-status.html.twig
  2. In another issue / MR, Remove the hard-coded text and override Http4xxController and set it there.

I will open a PR for item 1 here and open a seperate issue in localgov_core for point 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants