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

feat: add exception pages #22

Merged
merged 2 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion templates/assets/dist/style.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions templates/error/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = '页面找不到 - ' + ${site.title}, header = null, content = ~{::content}, head = null, footer = null, sidebar = null, contentClass = null)}"
>
<th:block th:fragment="content">
<th:block th:replace="~{error/exception :: exception}" />
</th:block>
</html>
9 changes: 9 additions & 0 deletions templates/error/500.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = '服务器异常 - ' + ${site.title}, header = null, content = ~{::content}, head = null, footer = null, sidebar = null, contentClass = null)}"
>
<th:block th:fragment="content">
<th:block th:replace="~{error/exception :: exception}" />
</th:block>
</html>
15 changes: 15 additions & 0 deletions templates/error/exception.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<section th:fragment="exception" class="flex items-center dark:bg-gray-900 dark:text-gray-100">
<div class="container mx-auto my-8 flex flex-col items-center justify-center px-5">
<div class="max-w-md text-center">
<h2 class="mb-8 text-9xl font-extrabold dark:text-gray-600" th:text="${status}"></h2>
<p class="mb-8 text-2xl font-semibold md:text-3xl" th:text="${error}"></p>
ruibaby marked this conversation as resolved.
Show resolved Hide resolved
<a
th:href="@{${site.url}}"
class="whitespace-no-wrap group inline-flex items-center justify-center gap-1 rounded-md border border-gray-200 bg-white px-4 py-1 text-sm font-medium leading-6 text-gray-600 shadow-sm hover:bg-gray-50 focus:shadow-none focus:outline-none dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:hover:bg-slate-600 dark:hover:text-white"
>
<span class="i-tabler-arrow-left text-lg transition-all group-hover:-translate-x-1"></span>
<span>返回首页</span>
</a>
</div>
</div>
</section>