Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Add 404 template #56

Closed
wants to merge 27 commits into from
Closed

Conversation

cliffralessio
Copy link

@cliffralessio cliffralessio commented Aug 19, 2024

Description

<-- This pull request introduces a new 404 error page pattern for the Twenty Twenty-Five WordPress theme. -->

Image License and Source

<-- Image License: Pexels License-->
<-- Image Source: https://www.pexels.com/-->

Pexels License Summary
<-- The images on Pexels can be used for free. -->
<-- Commercial and non-commercial use is allowed. -->
<-- Attribution is not required, but giving credit to the photographer is appreciated. -->

Co-authored-by: cliffralessio [email protected]

Copy link

github-actions bot commented Aug 19, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: cliffralessio <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: juanfra <[email protected]>
Co-authored-by: tanvirulhaque <[email protected]>
Co-authored-by: huzaifaalmesbah <[email protected]>
Co-authored-by: mukeshpanchal27 <[email protected]>
Co-authored-by: shail-mehta <[email protected]>
Co-authored-by: rejaulalomkhan <[email protected]>
Co-authored-by: kafleg <[email protected]>
Co-authored-by: beafialho <[email protected]>
Co-authored-by: up1512001 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

patterns/hidden-404.php Outdated Show resolved Hide resolved
@carolinan

This comment was marked as resolved.

@juanfra juanfra linked an issue Aug 19, 2024 that may be closed by this pull request
@shail-mehta
Copy link
Member

@cliffralessio Thanks for the PR.

Could you please remove this class wp-image-17 in
patterns/hidden-404.php file line no 13?

patterns/hidden-404.php
@rejaulalomkhan
Copy link
Contributor

@cliffralessio Thanks for making progress in resolving this issue.

templates/404.html Outdated Show resolved Hide resolved
templates/404.html Outdated Show resolved Hide resolved
patterns/hidden-404.php Outdated Show resolved Hide resolved
@carolinan

This comment was marked as resolved.

Copy link
Member

@juanfra juanfra left a comment

Choose a reason for hiding this comment

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

Great progress @cliffralessio, thanks for working on this!

There are some presets already merged that you can make use of. I left some comments about a few things that are repeated throughout the code. If you re-base the branch with the latest changes in trunk you'll have the chance to use the linter and catch many of the issues that are currently happening.

The other thing that I'd like to ask is if you can please use tabs instead of spaces for the blank spaces, so that we're consistent with that across default themes.

patterns/hidden-404.php Outdated Show resolved Hide resolved
patterns/hidden-404.php Outdated Show resolved Hide resolved
patterns/hidden-404.php Outdated Show resolved Hide resolved
templates/404.html Outdated Show resolved Hide resolved
@cliffralessio
Copy link
Author

@juanfra Thank you for helping me, this is my first contribution and I know I am making many mistakes, but on the other hand, thanks to you and @carolinan I am learning a lot!

@rejaulalomkhan
Copy link
Contributor

Could we add a meaningful 404-related image name instead of this image-from-rawpixel-id-13029755-jpeg.webp

Copy link
Member

@juanfra juanfra left a comment

Choose a reason for hiding this comment

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

Thank you for working on this @cliffralessio - There has been a lot of progress! the code looks way better, but the design is not there quite yet. When checking your branch I can see that the content area is not taking the full width and it's shown in a narrow column.

I'm sharing a screencast showing how you can adjust some of the configurations of the different blocks you have to get closer. Please let me know if I can be of help; we're almost there 🏅

404-template.mov

@cliffralessio
Copy link
Author

@juanfra Thank you for your help, I followed your instructions but I am not sure about one thing.

When I see my template from a 1440px device everything is fine but, when I see it from a larger device my tamplate is always on the left of the screen. Is everything okay?

<!-- /wp:group -->

<!-- wp:template-part {"slug":"footer","area":"footer","tagName":"footer"} /-->

Copy link
Contributor

Choose a reason for hiding this comment

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

Please change this file to using tabs, not spaces, and remove the trailing space at the end.
The last line of the file should be empty.

Suggested change

@carolinan
Copy link
Contributor

carolinan commented Aug 24, 2024

Even on smaller screens, the horizontal spacing is too large. It is getting the left and right spacing from both the template and the pattern.

Try removing the left and right padding from the columns block.

The block gap between the two columns could be larger to better match the design.

@carolinan

This comment was marked as resolved.

@cliffralessio
Copy link
Author

This is what I mean.

I think the whole pattern should be in the center of the screen, shouldn't it?

Screenshot 2024-08-24 alle 10 20 20

@carolinan carolinan added the [Status] Needs Design Feedback Needs general design feedback. label Aug 24, 2024
@beafialho
Copy link
Contributor

beafialho commented Aug 26, 2024

Thank you for your work @cliffralessio! I gave it a go with the row block and was able to achieve the design. But when I test it on mobile it doesn't look good. Somehow the same is happening with the grid block.

Captura de ecrã 2024-08-26, às 11 30 33

404.mp4

Here's the markup in case there's something wrong with what I'm doing:

<main class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|50"}},"layout":{"type":"flex","flexWrap":"nowrap","verticalAlignment":"bottom","justifyContent":"space-between"}} -->
<div class="wp-block-group"><!-- wp:image {"id":10,"width":"810px","height":"auto","sizeSlug":"full","linkDestination":"none","style":{"layout":{"rowSpan":1,"columnSpan":2}}} -->
<figure class="wp-block-image size-full is-resized"><img src="http://tt5.local/wp-content/uploads/2024/08/image-404.webp" alt="" class="wp-image-10" style="width:810px;height:auto"/></figure>
<!-- /wp:image -->

<!-- wp:group {"style":{"layout":{"columnSpan":7,"rowSpan":1}},"layout":{"type":"flex","orientation":"vertical","verticalAlignment":"bottom","justifyContent":"stretch","flexWrap":"wrap"}} -->
<div class="wp-block-group"><!-- wp:heading {"style":{"layout":{"columnSpan":8,"rowSpan":1}}} -->
<h2 class="wp-block-heading">Page not found</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The page you are looking for doesn’t exist, or it has been moved. Please try searching using the form below.</p>
<!-- /wp:paragraph -->

<!-- wp:search {"label":"Search","showLabel":false,"placeholder":"Type something...","width":null,"widthUnit":"%","buttonText":"Search","style":{"border":{"radius":"100px"}}} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group --></main>
<!-- /wp:group -->

@beafialho

This comment was marked as resolved.

<div class="wp-block-columns alignwide" style="padding-top:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50)">
<!-- wp:column {"width":"40%"} -->
<div class="wp-block-column" style="flex-basis:40%">
<!-- wp:image {"sizeSlug":"large","linkDestination":"none","className":"is-resized"} -->
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<!-- wp:image {"sizeSlug":"large","linkDestination":"none","className":"is-resized"} -->
<!-- wp:image {"sizeSlug":"large"} -->

Image is not resized and linked.

Copy link
Contributor

@carolinan carolinan Aug 26, 2024

Choose a reason for hiding this comment

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

These are the default values when you add an image in the block editor.
If they are removed, the editor has to manually add the class name and change the markup to this:
<!-- wp:image {"id":19,"className":"size-large"} -->
Please motivate why it should be removed?

@cliffralessio
Copy link
Author

cliffralessio commented Aug 26, 2024

@beafialho I think it doesn't work because you are using a fixed size for the width:
<!-- wp:image {“id”:10, “width”: “810px”

@carolinan
Copy link
Contributor

If this design is blocked, should we try a different design?

@cliffralessio
Copy link
Author

Why is it blocked?

@carolinan
Copy link
Contributor

I am reading comments from two people who are unable to make the design work well on all screen sizes.
So an option would be to change the design, instead of not progressing on the implementation of the current design.

@beafialho
Copy link
Contributor

If it doesn't work with the row, nor the grid block, I tried with columns block. It achieves the design and it works across screen sizes 🎉 I believe this should solve it:

404.mp4
<!-- wp:group {"tagName":"main","metadata":{"name":"Page not found"},"style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"}}},"layout":{"type":"default"}} -->
<main class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)"><!-- wp:columns {"verticalAlignment":null,"style":{"spacing":{"blockGap":{"top":"var:preset|spacing|50","left":"var:preset|spacing|50"}}}} -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":10,"scale":"cover","sizeSlug":"full","linkDestination":"none","style":{"layout":{"rowSpan":1,"columnSpan":2}}} -->
<figure class="wp-block-image size-full"><img src="http://tt5.local/wp-content/uploads/2024/08/image-404.webp" alt="" class="wp-image-10" style="object-fit:cover"/></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->

<!-- wp:column {"verticalAlignment":"bottom"} -->
<div class="wp-block-column is-vertically-aligned-bottom"><!-- wp:group {"style":{"layout":{"columnSpan":7,"rowSpan":1}},"layout":{"type":"default"}} -->
<div class="wp-block-group"><!-- wp:heading {"style":{"layout":{"columnSpan":8,"rowSpan":1}}} -->
<h2 class="wp-block-heading">Page not found</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The page you are looking for doesn’t exist, or it has been moved. Please try searching using the form below.</p>
<!-- /wp:paragraph -->

<!-- wp:search {"label":"Search","showLabel":false,"placeholder":"Type something...","buttonText":"Search","style":{"border":{"radius":"999px"}}} /--></div>
<!-- /wp:group --></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></main>
<!-- /wp:group -->

templates/404.html Outdated Show resolved Hide resolved
@carolinan
Copy link
Contributor

The following changes needs to be made:

  1. Solve the merge conflict in the readme.txt file.

  2. Copy the new markup from the comment by Bea above:

The opening and closing of the main element must be in the HTML file: But without the meta data, which you must remove:

<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"}}},"layout":{"type":"default"}} -->
<main class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)">
</main>
<!-- /wp:group -->

Meaning the columns block must be in the PHP file, replacing the current markup.

In the columns, the source of the image must be updated, because when copy-pasting the pattern, the previous PHP code is lost.

<!-- wp:group {"style":{"layout":{"columnSpan":7,"rowSpan":1}},"layout":{"type":"default"}} -->
<div class="wp-block-group">
<!-- wp:heading {"level":3,"style":{"typography":{"fontStyle":"normal","fontWeight":"500"}}} -->
<h3 class="wp-block-heading" style="font-style:normal;font-weight:500">
Copy link
Contributor

Choose a reason for hiding this comment

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

The main heading on the page should be an H1.

@carolinan
Copy link
Contributor

I am not able to do a git pull for this PR, it is getting rejected.

From https://github.com/WordPress/twentytwentyfive
 ! [rejected]        refs/pull/56/head -> cliffralessio/trunk  (non-fast-forward)
failed to run git: exit status 1

For the sake of speed, I'll try to create a new PR and merge it asap.

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

Successfully merging this pull request may close these issues.

Add 404 template
10 participants