Feat: add PWA i18n and add offline embedded tpl

This commit is contained in:
Cell
2022-01-17 17:42:39 +08:00
parent 9cb76d6025
commit 7e313005ac
10 changed files with 69 additions and 36 deletions
+1
View File
@@ -30,4 +30,5 @@
@import "_archive";
@import "_home";
@import "_404";
@import "_offline";
@import "_friends";
+20
View File
@@ -0,0 +1,20 @@
#content-offline {
@include transform(translateY(30vh));
text-align: center;
.offline-title {
font-size: 3.6rem;
vertical-align: text-bottom;
}
.offline-subtitle {
margin: 0.4rem 0;
font-size: 1rem;
font-weight: normal;
font-style: italic;
line-height: 100%;
color: #57606a;
}
.error-text {
font-size: 1.2rem;
}
}
+3
View File
@@ -0,0 +1,3 @@
---
type: "offline"
---
-35
View File
@@ -1,35 +0,0 @@
---
title: "離線 (Offline)"
comment: false
---
> 您沒有連接到 Internet,只有緩存的頁面可用。
> You are not connected to the Internet, only cached pages will be available.
```bash
███████ ███████████ ███████████ █████ █████ ██████ █████ ██████████
███░░░░░███ ░░███░░░░░░█░░███░░░░░░█░░███ ░░███ ░░██████ ░░███ ░░███░░░░░█
███ ░░███ ░███ █ ░ ░███ █ ░ ░███ ░███ ░███░███ ░███ ░███ █ ░
░███ ░███ ░███████ ░███████ ░███ ░███ ░███░░███░███ ░██████
░███ ░███ ░███░░░█ ░███░░░█ ░███ ░███ ░███ ░░██████ ░███░░█
░░███ ███ ░███ ░ ░███ ░ ░███ █ ░███ ░███ ░░█████ ░███ ░ █
░░░███████░ █████ █████ ███████████ █████ █████ ░░█████ ██████████
░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░
▒█████ █████▒ █████▒██▓ ██▓ ███▄ █ ▓█████
▒██▒ ██▒▓██ ▒▓██ ▒▓██▒ ▓██▒ ██ ▀█ █ ▓█ ▀
▒██░ ██▒▒████ ░▒████ ░▒██░ ▒██▒▓██ ▀█ ██▒▒███
▒██ ██░░▓█▒ ░░▓█▒ ░▒██░ ░██░▓██▒ ▐▌██▒▒▓█ ▄
░ ████▓▒░░▒█░ ░▒█░ ░██████▒░██░▒██░ ▓██░░▒████▒
░ ▒░▒░▒░ ▒ ░ ▒ ░ ░ ▒░▓ ░░▓ ░ ▒░ ▒ ▒ ░░ ▒░ ░
░ ▒ ▒░ ░ ░ ░ ░ ▒ ░ ▒ ░░ ░░ ░ ▒░ ░ ░ ░
░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░
████▄ ▄████ ▄████ █ ▄█ ▄ ▄███▄
█ █ █▀ ▀ █▀ ▀ █ ██ █ █▀ ▀
█ █ █▀▀ █▀▀ █ ██ ██ █ ██▄▄
▀████ █ █ ███▄ ▐█ █ █ █ █▄ ▄▀
█ █ ▀ ▐ █ █ █ ▀███▀
▀ ▀ █ ██
```
@@ -0,0 +1,3 @@
---
type: "offline"
---
+1 -1
View File
@@ -1 +1 @@
/zh-cn/* /zh-cn/404.html 404
/zh-cn/* /zh-cn/404.html 404
+8
View File
@@ -155,6 +155,14 @@ other = "Page not found"
other = "The page you're looking for doesn't exist. Sorry."
# === 404.html ===
# === offline ===
[offlineTitle]
other = "Offline"
[offlineText]
other = "You are not connected to the Internet, only cached pages will be available."
# === offline ===
# === shortcodes/admonition.html ===
[note]
other = "Note"
+8
View File
@@ -160,6 +160,14 @@ other = "页面没找到"
other = "抱歉,您要查找的页面不存在。"
# === 404.html ===
# === offline ===
[offlineTitle]
other = "离线"
[offlineText]
other = "您没有连接到 Internet,只有缓存的页面可用。"
# === offline ===
# === shortcodes/admonition.html ===
[note]
other = "注意"
+8
View File
@@ -160,6 +160,14 @@ other = "找不到網頁"
other = "抱歉,您要查找的頁面不存在。"
# === 404.html ===
# === offline ===
[offlineTitle]
other = "離線"
[offlineText]
other = "您沒有連接到 Internet,只有緩存的頁面可用。"
# === offline ===
# === shortcodes/admonition.html ===
[note]
other = "Note"
+17
View File
@@ -0,0 +1,17 @@
{{- define "title" }}
{{- T "offlineTitle" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
<div class="page" id="content-offline">
<h1 class="offline-title animated pulse faster">{{- T "offlineTitle" -}}</h1>
<h2 class="offline-subtitle">
<i class="fa-stack fa-xs">
<i class="fas fa-wifi fa-stack-1x"></i>
<i class="fas fa-ban fa-stack-2x"></i>
</i>
<span>ERROR_INTERNET_DISCONNECTED</span>
</h2>
<p class="error-text">{{- T "offlineText" -}}</p>
</div>
{{- end -}}