Skip to content

Show 404 page for documentation site#333

Merged
aduth merged 3 commits intomainfrom
aduth-docs-404
Apr 28, 2023
Merged

Show 404 page for documentation site#333
aduth merged 3 commits intomainfrom
aduth-docs-404

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Mar 21, 2023

As part of the current effort to deprecate design.login.gov, show a 404 page in place of site contents, so that a user has resources to learn more about Login.gov or receive support.

Live preview: https://federalist-2f194a10-945e-4413-be01-46ca6dae5358.sites.pages.cloud.gov/preview/18f/identity-style-guide/aduth-docs-404/404.html

This is derived from the Login.gov main site 404 page: https://www.login.gov/404.html

Next steps:

  • Revisions to _config.yml will not be committed, they are for demonstration only in the preview environment. The plan would be to configure these through Cloud.gov Pages interface
    • Configuration in 6982fbd will be applied in Cloud.gov Pages site admin
  • Excluding content in the live environment will allow us to continue using the documentation site for internal testing and pull request previews

Draft while I sort out why Cloud.gov Pages doesn't show the 404 page by default. See #333 (comment)

@aduth
Copy link
Contributor Author

aduth commented Mar 22, 2023

I was struggling to get the 404 page to show up in the preview environment. Based on a related Slack comment, I believe Cloud.gov Pages will always try to use the production deployment's 404 page, hence why it's not yet showing up here.

Since the plan will be to apply the configuration reverted in 6982fbd in the Cloud.gov Pages Dashboard, merging this as-is won't actually remove any content from the site, but it will add the 404 page so that we can at least confirm it's working in production before applying the new configuration.

So effectively, this pull request simply adds a 404 page, but does not affect any other existing content.

@aduth aduth marked this pull request as ready for review March 22, 2023 13:31
@aduth
Copy link
Contributor Author

aduth commented Mar 22, 2023

The visual regression build failure reflects the change discussed at #333 (comment) .

Compare:

Before After
image image

@aduth
Copy link
Contributor Author

aduth commented Mar 22, 2023

Maybe we need to normalize the intrinsic sizes of those two images.

@aduth
Copy link
Contributor Author

aduth commented Mar 23, 2023

Maybe we need to normalize the intrinsic sizes of those two images.

In 608fde9, I recreated the reverse logo by taking the original and swapping out all the #112E51 with #ffffff 🤷

Preview: https://federalist-2f194a10-945e-4413-be01-46ca6dae5358.sites.pages.cloud.gov/preview/18f/identity-style-guide/aduth-docs-404/brand/

@nickttng
Copy link
Contributor

In 608fde9, I recreated the reverse logo by taking the original and swapping out all the #112E51 with #ffffff 🤷

This approach works, and it looks good to me.

As part of the current effort to deprecate design.login.gov, show a 404 page in place of site contents, so that a user has resources to learn more about Login.gov or receive support.
@aduth aduth marked this pull request as draft April 28, 2023 19:41
Allows base_url support
@aduth aduth marked this pull request as ready for review April 28, 2023 19:54
@aduth aduth requested a review from zachmargolis April 28, 2023 19:54
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -0,0 +1,3 @@
---
layout: 404
Copy link
Contributor

Choose a reason for hiding this comment

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

does the docs dir already go to top level? do we need to add a permalink so that it's in the right place to be a 404 page for CG pages?

Suggested change
layout: 404
layout: 404
permalink: /404.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's fine without? It seems to be available at /404.html already without specifying permalink.

@aduth aduth merged commit 5493975 into main Apr 28, 2023
@aduth aduth deleted the aduth-docs-404 branch April 28, 2023 20:31
@aduth
Copy link
Contributor Author

aduth commented Apr 28, 2023

Confirmed that the 404 configuration approach works.

Example†: https://federalist-2f194a10-945e-4413-be01-46ca6dae5358.sites.pages.cloud.gov/preview/18f/identity-style-guide/aduth-lgds-7/

I did this by adding the following configuration to the Preview Site configuration:

exclude:
  - '*'
include:
  - 404.html

To decommission the production site, we'll just add that configuration to the Live Site configuration.


† The broken image and styles are somewhat expected, for the same reason as described at #333 (comment) : Cloud.gov Pages 404 pages always use the live site's 404 page, which would include references to root-relative /assets/ that don't exist in the preview environment. It'll be fine on the live site, though.

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.

3 participants