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

adds default content for 403 and 404 pages #699

Merged
merged 6 commits into from
Feb 11, 2025

Conversation

markconroy
Copy link
Member

Closes #698

What does this change?

  1. Adds a variable in page-status.html.twig for "default_status_content"
  2. We use this variable in the page--403/page--404.html.twig file to set a nice default message for these pages
  3. When then check to see if a custom 403/404 page has been set (as a node) and if so, we set the new variable to false and use the content from the node

How to test

  • Check by default we now have better 403/404 content.
  • Then set custom nodes as the default for 403/404
  • Check that the template content is overridden

@willguv
Copy link
Member

willguv commented Jan 15, 2025

Hi @markconroy thanks for this - was on my long list. How does a content designer set 403 and 404 pages please, and can I see our default?

@markconroy
Copy link
Member Author

How does a content designer set 403 and 404 pages please

Within the CMS, you can create a node and then set that node as your 403 or 404 page. You can see in this screenshot, I have chosen /node/1 as my 404 page and left 403 page blank. This means the 403 page will use our hardcoded template and the 404 page will use whatever content is in Node 1.

Screenshot 2025-01-16 at 08 44 05

Here's our (new) defaults when using the updated templates.

Screenshot 2025-01-16 at 08 45 31
Screenshot 2025-01-16 at 08 45 55

@willguv
Copy link
Member

willguv commented Jan 16, 2025

Thanks Mark, where's the error page setting please?

Is it possible to make a couple of minor changes to the default text?

On the 404, remove the last sentence "The requested page could not be found."

On the 403, again remove the last sentence " You are not authorized to access this page."

In both cases the wording above is friendlier and better

@markconroy
Copy link
Member Author

Page setting is at: /admin/config/system/site-information

I'll get the default items removed.

@markconroy markconroy marked this pull request as ready for review January 28, 2025 12:41
@finnlewis finnlewis self-assigned this Feb 5, 2025
@finnlewis
Copy link
Member

@markconroy I've made a small change to address the php static analysis checks: 5afeb30

I tested before and after and the functionality works as outlined for me.

Could you just confirm that change looks good to you?

Cheers,

Finn

Copy link
Member

@finnlewis finnlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as detailed and tests are passing now :)

Thanks @markconroy

@finnlewis finnlewis merged commit 5f77e44 into 1.x Feb 11, 2025
17 checks passed
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

Successfully merging this pull request may close these issues.

Improve wording on 404 pages
3 participants