Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
44 changes: 44 additions & 0 deletions error-404.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{!< default}}

{{!--
404 page. Inherits the default layout so visitors keep the theme's
navigation, footer, and overall look while they figure out where to go.
--}}

<main class="gh-main">

<article class="gh-article gh-canvas">

<header class="gh-article-header">
<h1 class="gh-article-title is-title">{{statusCode}}</h1>
<p class="gh-article-excerpt is-body">{{t "Page not found"}}</p>
</header>

<section class="gh-content is-body">
<p>
<a href="{{@site.url}}" class="gh-button">{{t "Go to the front page →"}}</a>
</p>
</section>

</article>

</main>

{{!-- Visitors landing here didn't find what they were looking for.
Suggest a few recent posts to help them re-engage. --}}
{{#get "posts" include="authors" limit="3" as |suggested|}}
{{#if suggested}}
<section class="gh-container is-grid gh-outer">
<div class="gh-container-inner gh-inner">
<h2 class="gh-container-title">{{t "Recent posts"}}</h2>
<main class="gh-main">
<div class="gh-feed">
{{#foreach suggested}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
</div>
</main>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
</div>
</section>
{{/if}}
{{/get}}
66 changes: 66 additions & 0 deletions error.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{!--
Generic error template — handles all non-404 errors (500, etc.).
Standalone (doesn't extend default.hbs) and kept lightweight on
purpose: minimal dependencies, no partials, no API calls.

The reasoning mirrors Casper's: 500 errors usually happen when
something on the server is struggling, so we don't want the error
page itself to compound the issue. Keep this template as
self-contained as possible.
--}}

<!DOCTYPE html>
<html lang="{{@site.locale}}">
<head>
<title>{{meta_title}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{{asset "built/screen.css"}}">
<style>
:root {
--background-color: {{@custom.site_background_color}}
}
</style>
{{ghost_head}}
</head>
<body class="{{body_class}}">

Comment thread
coderabbitai[bot] marked this conversation as resolved.
<main class="gh-main">

<article class="gh-article gh-canvas">

<header class="gh-article-header">
<h1 class="gh-article-title is-title">{{statusCode}}</h1>
<p class="gh-article-excerpt is-body">{{message}}</p>
</header>

<section class="gh-content is-body">
<p>
<a href="{{@site.url}}" class="gh-button">{{t "Go to the front page →"}}</a>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove theme helpers from generic error template

In error.hbs, using {{t}} makes the generic error page depend on a theme helper even though Ghost’s error-template contract expects error.hbs to avoid theme helpers (except asset) to reduce cascading failures and misleading diagnostics during 5xx handling. If the original failure is related to helper/theme rendering, this can cause the error template itself to fail or mask the root cause. Replace translated helper output here with static text (or move helper-dependent UX to error-404.hbs, where helpers are allowed).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Checked Casper's error.hbs (the reference Ghost theme) — it uses {{t "Go to the front page →"}} and {{t "Theme errors"}} for these exact strings: https://github.com/TryGhost/Casper/blob/main/error.hbs#L49-L54

The actual Ghost convention for error.hbs is no partials, no JS, no API calls (no {{#get}}) to avoid compounding 5xx failures — not "no theme helpers". {{t}} is a pure string-lookup helper with no rendering/data dependency, so it doesn't carry that risk. Keeping the translations.

</p>
</section>

{{#if errorDetails}}
<section class="gh-content is-body">
<h3>{{t "Theme errors"}}</h3>
<ul>
{{#foreach errorDetails}}
<li>
<strong>{{rule}}</strong>
{{#foreach failures}}
<p>{{ref}}: {{message}}</p>
{{/foreach}}
</li>
{{/foreach}}
</ul>
</section>
{{/if}}

</article>

</main>

{{ghost_foot}}

</body>
</html>
1 change: 1 addition & 0 deletions locales/context.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "solo/post.hbs",
"Older Posts": "ghost-tpl/pagination.hbs",
"Page {page} of {totalPages}": "alto/partials/pagination.hbs, ghost-tpl/pagination.hbs",
"Page not found": "Friendly message shown on 404 pages",
"Paid": "solo/partials/loop.hbs",
"Paid-members only": "casper/partials/post-card.hbs",
"Please enter a valid email address": "ghost-private/private.hbs",
Expand Down
1 change: 1 addition & 0 deletions locales/de-CH.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "Weiter →",
"Older Posts": "Ältere Beiträge",
"Page {page} of {totalPages}": "Seite {page} von {totalPages}",
"Page not found": "",
"Paid": "Kostenpflichtig",
"Paid-members only": "Nur für zahlende Mitglieder",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "Suivant →",
"Older Posts": "Publications plus anciennes",
"Page {page} of {totalPages}": "Page {page} sur {totalPages}",
"Page not found": "Page introuvable",
"Paid": "Payant",
"Paid-members only": "Réservé aux abonnés payants",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/ga.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/gd.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "Sonraki →",
"Older Posts": "Daha Eski Yazılar",
"Page {page} of {totalPages}": "Sayfa {page} / {totalPages}",
"Page not found": "",
"Paid": "Ücretli",
"Paid-members only": "Ücretli üyelere özel",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "Далі →",
"Older Posts": "Старіші дописи",
"Page {page} of {totalPages}": "Сторінка {page} з {totalPages}",
"Page not found": "",
"Paid": "Платний",
"Paid-members only": "Тільки за платною підпискою",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "付費會員限定",
"Please enter a valid email address": "",
Expand Down
1 change: 1 addition & 0 deletions locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Next →": "",
"Older Posts": "",
"Page {page} of {totalPages}": "",
"Page not found": "",
"Paid": "",
"Paid-members only": "",
"Please enter a valid email address": "",
Expand Down