Skip to content

Commit

Permalink
feat(pwa): Create an offline page
Browse files Browse the repository at this point in the history
Signed-off-by: Khusika Dhamar Gusti <[email protected]>
  • Loading branch information
Khusika Dhamar Gusti committed Jul 10, 2021
1 parent 1a4ffbd commit c824f4b
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 1 deletion.
1 change: 1 addition & 0 deletions assets/css/_page/_404.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
font-weight: 900;
color: $global-font-color;
letter-spacing: 1rem;
text-transform: uppercase;
margin-bottom: 5rem;
[theme=dark] & {
color: $global-font-color-dark;
Expand Down
5 changes: 5 additions & 0 deletions content/offline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Offline"
draft: false
offline: true
---
5 changes: 5 additions & 0 deletions i18n/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ other = "Seite nicht gefunden"
other = "Leider konnte die von Ihnen angeforderte Seite nicht aufgerufen werden."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Sie sind offline. Prüfe deine Internetverbindung."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Notiz"
Expand Down
5 changes: 5 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ other = "Page not found"
other = "The page you're looking for doesn't exist. Sorry."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "You're offline. Check your internet connection."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Note"
Expand Down
5 changes: 5 additions & 0 deletions i18n/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ other = "Página no encontrada"
other = "La página que estás buscando no existe. Lo siento."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Estás desconectado. Comprueba tu conexión a Internet."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Nota"
Expand Down
5 changes: 5 additions & 0 deletions i18n/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ other = "Page non trouvée"
other = "Désolé, la page recherchée n'existe pas."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Tu es hors ligne. Vérifiez votre connection internet."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Remarque"
Expand Down
5 changes: 5 additions & 0 deletions i18n/id.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ other = "Halaman tidak ditemukan"
other = "Maaf, halaman yang Anda cari tidak ada."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Anda sedang offline. Periksa koneksi internet Anda."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Catatan"
Expand Down
5 changes: 5 additions & 0 deletions i18n/it.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ other = "Pagina non trovata"
other = "Mi spiace, la pagina cercata non esiste."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Sei offline. Controlla la tua connessione Internet."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Note"
Expand Down
5 changes: 5 additions & 0 deletions i18n/pl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ other = "Nie znaleziono strony"
other = "Wybacz, chyba coś namieszaliśmy."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Jesteś offline. Sprawdź swoje łącze internetowe."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Notka"
Expand Down
5 changes: 5 additions & 0 deletions i18n/pt-BR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ other = "Página não encontrada"
other = "A página que você procura não existe. Desculpe"
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Você está offline. Verifique sua conexão com a internet."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Nota"
Expand Down
5 changes: 5 additions & 0 deletions i18n/ro.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ other = "Pagina nu a fost găsită"
other = "Pagina pe care o căutați nu există. Ne cerem scuze."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Ești offline. Verificați conexiunea la internet."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Notă"
Expand Down
5 changes: 5 additions & 0 deletions i18n/ru.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ other = "Страница не найдена"
other = "Страница, которую вы ищете, не существует. Приносим извинения."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Ты не в сети. Проверьте ваше интернет-соединение."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Замечание"
Expand Down
5 changes: 5 additions & 0 deletions i18n/sr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ other = "Страница није пронађена"
other = "Страница коју тражите не постоји. Жао нам је."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Ван мреже сте. Проверите интернет везу."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Напомена"
Expand Down
5 changes: 5 additions & 0 deletions i18n/vi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ other = "Không tìm thấy trang"
other = "Trang bạn đang tìm kiếm không tồn tại. Xin lỗi."
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "Bạn đang ngoại tuyến. Kiểm tra kết nối Internet của bạn."
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "Ghi chú"
Expand Down
5 changes: 5 additions & 0 deletions i18n/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ other = "页面没找到"
other = "抱歉,您要查找的页面不存在。"
# === 404.html ===

# === Offline Page ===
[pageOffline]
other = "你离线了。 检查您的互联网连接。"
# === Offline Page ===

# === shortcodes/admonition.html ===
[note]
other = "注意"
Expand Down
13 changes: 13 additions & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}

{{- $offline := $params.offline -}}
{{- if ne $offline true -}}

{{- $toc := $params.toc -}}
{{- if eq $toc true -}}
{{- $toc = .Site.Params.page.toc | default dict -}}
Expand Down Expand Up @@ -68,4 +71,14 @@ <h2 class="single-subtitle animated fadeInDown faster">{{ . }}</h2>
{{- /* Comment */ -}}
{{- partial "comment.html" . -}}
</article>
{{- else if eq $offline true -}}
<article class="page" id="content-404">
<h2>{{ .Title }}</h2>
<p>
{{- T "pageOffline" -}}
</p>
<a href="{{ .Site.Home.RelPermalink }}" title="{{ T `home` }}">{{ T `home` }}</a>
<a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();">{{ T `back` }}</a>
</article>
{{- end -}}
{{- end -}}

Large diffs are not rendered by default.

0 comments on commit c824f4b

Please sign in to comment.