Skip to content

Commit

Permalink
Merge pull request #5 from 2kool4idkwhat/main
Browse files Browse the repository at this point in the history
a11y: add a "skip to main content" link
  • Loading branch information
clente authored Sep 29, 2023
2 parents 21c4876 + afebeba commit 6f2e7d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,18 @@ h3.blog-filter {
cursor: not-allowed;
opacity: 0.7;
}

/* "skip to main content" link */
.skiplink {
position: absolute;
top: 5;
transform: translateY(-600%);
transition: transform 0.5s;
background-color: #121212;
font-size: larger;
padding: 6px;
}

.skiplink:focus {
transform: translateY(0%);
}
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<header>
{{- partial "header.html" . -}}
</header>
<main>
<main id="maincontent">
{{- block "main" . }}{{- end }}
</main>
<footer>
Expand Down
2 changes: 2 additions & 0 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<a class="skiplink" href="#maincontent">Skip to Main Content</a>

<a href="{{ relURL .Site.Home.Permalink }}" class="title"><h1>{{ .Site.Title }}</h1></a>
<nav>{{- partial "nav.html" . -}}</nav>

0 comments on commit 6f2e7d0

Please sign in to comment.