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

[6892] Add error pages (404, 500) to Wordify BP #118

Merged
merged 6 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion craftercms-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugin:
version:
major: 2
minor: 0
patch: 44
patch: 45
description: |
A versatile blog blueprint.
website:
Expand Down
7 changes: 7 additions & 0 deletions templates/web/errors/404.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<#include "./errorPageLayout.ftl">

<@errorPageLayout
pageTitle="Page not found"
errorCode="404"
errorMessage="Sorry, we couldn't find the page you're looking for"
/>
7 changes: 7 additions & 0 deletions templates/web/errors/500.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<#include "./errorPageLayout.ftl">

<@errorPageLayout
pageTitle="Internal Server Error"
errorCode="500"
errorMessage="Oops! A server error has occurred and we were unable to fulfill the request.<br/> Please try again. If the error persists, contact the administrator of the site."
/>
49 changes: 49 additions & 0 deletions templates/web/errors/errorPageLayout.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<#macro errorPageLayout
pageTitle=""
errorCode=""
errorTitle=pageTitle
errorMessage=""
>
<!DOCTYPE html>
<html>
<head>
<title>${pageTitle}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:300, 400,700|Inconsolata:400,700" rel="stylesheet">
<link rel="stylesheet" href="/static-assets/css/bootstrap.css">
<link rel="stylesheet" href="/static-assets/css/style.css">
<style>
.wrap {
height: 100vh;
text-align: center;
padding-top: 8rem;
padding-bottom: 8rem;
}
.title {
font-size: 60px;
}
@media (max-width: 992px) {
.title {
font-size: 40px;
}
}
</style>
</head>
<body>
<div class="wrap">
<p>${errorCode}</p>
<h1 class="title">${errorTitle}</h1>
<p>${errorMessage}</p>
<a href="/" class="btn btn-primary rounded">Go back home</a>
</div>

<script defer src="/studio/static-assets/scripts/craftercms-xb.umd.js"></script>
<script>
document.addEventListener('craftercms.xb:loaded', () => {
window.craftercms.xb.post('ERROR_PAGE_CHECK_IN', { code: ${errorCode}, message: "${errorMessage}"});
});
</script>
</body>
</html>
</#macro>