Skip to content

Commit

Permalink
[6892] Add error pages (404, 500) to Wordify BP (#118)
Browse files Browse the repository at this point in the history
* [6892] Add error pages (404, 500) to Wordify BP

* [6892] Add go home button

* [6892] Add error page check-in

* [6892] Rename error template and macro from layout to errorPageLayout

* [6892] Remove old error layout ftl file

* Version update
  • Loading branch information
jvega190 committed Jul 18, 2024
1 parent 7d800a7 commit 9b38f7f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
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>

0 comments on commit 9b38f7f

Please sign in to comment.