Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions 14/umbraco-cms/tutorials/custom-error-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@

1. Navigate to the **Settings** section.
2. Create a new "_Document Type with Template_".
3. Name the Document Type **404**.
3. Name the Document Type **404 Page**.
1. Note: By default, Umbraco will generate the alias for this DocType as simply "Page," omitting the "404." You may want to manually adjust the alias to "404Page."

Check warning on line 40 in 14/umbraco-cms/tutorials/custom-error-page.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [UmbracoDocs.Editorializing] Consider removing 'simply' Raw Output: {"message": "[UmbracoDocs.Editorializing] Consider removing 'simply'", "location": {"path": "14/umbraco-cms/tutorials/custom-error-page.md", "range": {"start": {"line": 40, "column": 77}}}, "severity": "WARNING"}
Copy link
Contributor

Choose a reason for hiding this comment

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

How about adding a new step for actually updating the alias instead?
Like, "4. Change the alias to **Page404**" or something similar.

What do you think?

Copy link
Contributor Author

@bszyman bszyman Oct 30, 2024

Choose a reason for hiding this comment

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

@sofietoft What if I told you that I completely agree, on re-reading this the second time though? :)

I added a step 4 and updated the rest of the sequence. I also left a note on step 4 to give the "why." It feels awkward maybe, but I think it's important to tell people why they need to do this.

Submitted a change, LMK what you think!

4. \[Optional] Add properties on the Document Type.
1. In most cases, the 404 not found page would be static.
5. Fill out the Template with your custom markup.
6. Create another **Document Type**, but create it without the Template.
7. Call this Document Type **Statuscodes**.
8. Open the **Structure** Workspace view.
9. Check the **Allow at root** option.
10. Add the **404** Document Type as an **Allowed child note type**.
10. Add the **404 Page** Document Type as an **Allowed child note type**.
11. Navigate to the **Content** section.
12. Create a **Statuscodes** content item called **Statuscodes**.
13. Create a **404** content item under the **Statuscodes** content.
13. Create a **404 Page** content item under the **Statuscodes** content.

### Set a custom 404 page in the configuration

Expand Down Expand Up @@ -116,7 +117,7 @@

// Find the first notFound page at the root level through the published content cache by its documentTypeAlias
// You can make this search as complex as you want, you can return different pages based on anything in the original request
var notFoundPage = umbracoContext.Content?.GetAtRoot().FirstOrDefault(c => c.ContentType.Alias == "Page404");
var notFoundPage = umbracoContext.Content?.GetAtRoot().FirstOrDefault(c => c.ContentType.Alias == "404Page");
if (notFoundPage == null)
{
return Task.FromResult(false);
Expand Down
Loading