From 3f8ec96f3436b1b1a1c91807694280cb08fe7ce9 Mon Sep 17 00:00:00 2001 From: Ngô Ngọc Đức Huy Date: Fri, 4 Aug 2023 08:30:03 +0700 Subject: Implement skip to main link --- assets/css/theme.css | 14 ++++++++++++++ i18n/en.toml | 3 +++ i18n/fr.toml | 3 +++ i18n/vi.toml | 3 +++ layouts/_default/single.html | 2 +- 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/assets/css/theme.css b/assets/css/theme.css index 1988b04..1162ae0 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -2,6 +2,20 @@ --column-width: 80ch; } +a.skip-main { + left: 0; + position: absolute; +} + +a.skip-main:not(:focus) { + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; + overflow: hidden; + white-space: nowrap; + width: 1px; +} + nav ul, nav ul li { display: inline-block; } diff --git a/i18n/en.toml b/i18n/en.toml index 1cf0f8a..64ee617 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -11,3 +11,6 @@ other = "{{ .WordCount }} words" ["reading time"] one = "approximately {{ .Count }} minute reading" other = "approximately {{ .Count }} minutes reading" + +[skipToContent] +other = "Skip to main content" diff --git a/i18n/fr.toml b/i18n/fr.toml index 563b24a..42481d0 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -11,3 +11,6 @@ other = "{{ .WordCount }} mots" ["reading time"] one = "environ {{ .Count }} minute de lecture" other = "environ {{ .Count }} minutes de lecture" + +[skipToContent] +other = "Aller à l'article" diff --git a/i18n/vi.toml b/i18n/vi.toml index c327799..97a6fc5 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -9,3 +9,6 @@ other = "{{ .WordCount }} từ" ["reading time"] other = "đọc hết khoảng {{ .Count }} phút" + +[skipToContent] +other = "Đi đến bài viết" diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a170823..16bf1ef 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -5,7 +5,7 @@ SPDX-License-Identifier: MIT */}} {{ define "main" }} -
+

{{ trim .Title " " }} -- cgit 1.4.1