Skip to content

Commit e8364ee

Browse files
committed
📦 Accessibility improvements
- Add content sectioning and aria roles to HTML - Adjust confusing CSS class names
1 parent b0b93c6 commit e8364ee

File tree

15 files changed

+147
-81
lines changed

15 files changed

+147
-81
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build exampleSite to docs/ with hugo-latest-cd
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: 🛎 Check out master
15+
uses: actions/checkout@master
16+
with:
17+
fetch-depth: 1
18+
- name: 🔧 Install tools
19+
run: sudo apt install curl jq
20+
- name: 🤵 Install Hugo
21+
run: |
22+
HUGO_VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.tag_name')
23+
mkdir tmp/ && cd tmp/
24+
curl -sSL https://github.com/gohugoio/hugo/releases/download/${HUGO_VERSION}/hugo_extended_${HUGO_VERSION: -6}_Linux-64bit.tar.gz | tar -xvzf-
25+
sudo mv hugo /usr/local/bin/
26+
cd .. && rm -rf tmp/
27+
hugo version
28+
- name: 🧹 Clean site
29+
run: |
30+
if [ -d "docs" ]; then
31+
rm -rf docs/*
32+
fi
33+
- name: 🍳 Build site
34+
run: |
35+
cd exampleSite
36+
HUGO_THEME="hugo-theme-sam" hugo --themesDir ../.. -v -d ../docs/
37+
- name: 🚀 Deploy build
38+
run: |
39+
git config user.name "${GITHUB_ACTOR}"
40+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
41+
git add .
42+
git commit -am "🚀 Deploy with ${GITHUB_WORKFLOW}"
43+
git push --all -f https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git
44+

assets/sass/_elements.sass

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
line-height: 3rem
2121
margin-bottom: 2rem
2222

23-
#content
24-
margin: 2rem 0
23+
article
24+
width: 100%
2525
line-height: 2em
2626
letter-spacing: 2px
2727
div
@@ -32,8 +32,9 @@
3232
margin: 1em 0em
3333
text-align: left
3434
& p
35+
display: block
3536
margin-bottom: 1em
36-
line-height: 1.8
37+
line-height: 1.6
3738
letter-spacing: 1.5px
3839
opacity: 0.8
3940
& .highlight
@@ -95,7 +96,7 @@
9596
list-style: decimal outside
9697
padding-left: 2rem
9798
& .gist
98-
width: 100%
99+
max-width: 100%
99100
td, th
100101
text-align: left
101102
border: 0
@@ -111,6 +112,7 @@
111112
opacity: 0.6
112113

113114
.grid
115+
margin: 1em auto
114116
display: grid
115117
grid-gap: 20px
116118
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr))

assets/sass/style.sass

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ body
2424
justify-content: space-between
2525
align-items: center
2626
opacity: 1
27+
padding: 6em 1em
28+
@media screen and (max-width: 736px)
29+
padding: 3em 1em
2730

2831
h1,h2,h3
2932
margin-bottom: 0.5em
30-
text-align: center
3133
font-family: 'Didact Gothic', sans-serif
3234
opacity: 0.6
3335

@@ -66,12 +68,14 @@ hr
6668
+skinny-hr
6769
opacity: 0.3
6870

71+
nav
72+
margin: 1em auto
73+
6974
.wrap
7075
margin: 0 auto
71-
margin-top: 6rem
7276
width: 45%
77+
max-width: 64em
7378
@media screen and (max-width: 736px)
74-
padding: 1rem
7579
width: 100%
7680

7781
.tag-container
@@ -85,7 +89,7 @@ hr
8589
position: relative
8690
bottom: 0
8791

88-
.section
92+
.flex-container
8993
display: flex
9094
flex-direction: column
9195
justify-content: center
@@ -96,7 +100,6 @@ hr
96100
flex-direction: column
97101
justify-content: center
98102
align-items: center
99-
padding-top: 3rem
100103
text-align: center
101104

102105
.footer
@@ -108,7 +111,7 @@ hr
108111
background-color: transparent
109112
position: relative
110113
bottom: 0
111-
padding: 3rem 1rem
114+
padding: 1rem
112115
font-family: $font
113116
font-size: 1rem
114117
line-height: 1em

exampleSite/content/about.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ title: "About"
33
date: 2018-02-13T13:42:49-05:00
44
---
55

6-
Hello, I'm Sam. I'm a theme for [Hugo](https://gohugo.io/). I'm an extremely customizable, content-focused theme that lets you showcase your work your way.
6+
Hello, I'm Sam. I'm a theme for [Hugo](https://gohugo.io/). I'm an extremely customizable, content-focused theme that lets you showcase your work your way. I'm [open source on GitHub](https://github.com/victoriadrake/hugo-theme-sam/).
77

88
I have slick minimalist templates for list pages (such as a list of blog posts) and single pages (a page to read one blog post). You can use tags on your content, and view content by tags.
99

1010
I also have a simple responsive gallery built with CSS grid. It'll look great on any screen, and all you have to do is provide a folder of images.
1111

12-
I'm built and maintained by [Victoria Drake](https://victoria.dev). Here's her [GitHub](https://github.com/victoriadrake).
12+
I'm built and maintained by [Victoria Drake](https://victoria.dev) and a lovely team of [contributors](https://github.com/victoriadrake/hugo-theme-sam/graphs/contributors).
1313

14-
This page uses the default `single.html` template.
14+
This page uses the default `baseof.html` template.

exampleSite/content/posts/image-post.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Hello! I'm a blog post with an image. Thanks to Open Graph and Twitter metadata,
1111

1212
![Ideas](/posts/ideas.png)
1313

14-
To make this happen, set the `images` parameter in your post's [front-matter](https://gohugo.io/content-management/front-matter/), like this:
14+
To make this happen, set the `images` parameter in your post's [front-matter](https://gohugo.io/content-management/front-matter/), like this YAML example:
1515

1616
```yaml
1717
images:
1818
- /posts/ideas.png
19-
```
19+
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
*{margin:0;padding:0;box-sizing:border-box}html{background-color:#39424e;font-family:didact gothic,sans serif;font-size:16px}body{font-size:16px;font-family:didact gothic,sans serif;color:#fff;line-height:2rem;letter-spacing:1.5px;text-shadow:none;display:flex;flex-direction:column;justify-content:space-between;align-items:center;opacity:1}h1,h2,h3{margin-bottom:.5em;text-align:center;font-family:didact gothic,sans-serif;opacity:.6}li{opacity:.8}li a{opacity:.9}ul{list-style-type:none}p{display:inline;opacity:.8}a{color:#ccc;text-decoration:none;border-bottom:2px solid #ccc;transition:.5s ease}a:hover{color:#fff;font-style:none}a:active{color:#ccc}button{padding:20px;border:0;border-radius:5px;background:#fff}button:hover{box-shadow:5px 5px #111}hr{margin:1rem 0;background-color:transparent;width:50%;border-style:solid;border-width:1px;opacity:.3}.wrap{margin:0 auto;margin-top:6rem;width:45%}@media screen and (max-width:736px){.wrap{padding:1rem;width:100%}}.tag-container{display:flex;flex-direction:row;justify-content:flex-start;align-items:center}.tag{background-color:transparent;position:relative;bottom:0}.section{display:flex;flex-direction:column;justify-content:center;align-items:flex-start}.bottom-menu{display:flex;flex-direction:column;justify-content:center;align-items:center;padding-top:3rem;text-align:center}.footer{width:100%;display:flex;justify-content:center;align-items:center;text-align:center;background-color:transparent;position:relative;bottom:0;padding:3rem 1rem;font-family:didact gothic,sans serif;font-size:1rem;line-height:1em;opacity:.8}.footer a{border-bottom:none;display:contents}#splash{margin:auto 0;height:100vh;width:45%;overflow:hidden}@media screen and (max-width:736px){#splash{width:90%}}.big-link{font-family:didact gothic,sans serif;font-size:3rem;font-weight:300;margin-bottom:2rem;line-height:1.5em}#title{margin-top:3rem;font-family:didact gothic,sans serif;font-size:2rem;line-height:3rem;margin-bottom:2rem}#content{margin:2rem 0;line-height:2em;letter-spacing:2px}#content div{width:100%;height:100%;margin-bottom:1em}#content h1,#content h2,#content h3{margin:1em 0;text-align:left}#content p{margin-bottom:1em;line-height:1.8;letter-spacing:1.5px;opacity:.8}#content .highlight{width:100%}#content pre{line-height:2rem;border-radius:3px;padding:1rem;overflow-x:auto;background-color:#000004;width:100%;margin-bottom:1em}#content pre>code{border:none}#content code{font-size:.9rem;font-family:source code pro,monospace;padding:.1rem;border-radius:3px;border:1px solid #ccc}#content img{width:100%;max-width:100%;display:block;margin:2rem auto;opacity:1}#content blockquote{background-color:#ccc;color:#39424e;padding:2rem;margin:2rem 1rem;border-radius:3px}#content blockquote a{color:#111}#content blockquote ul{margin-top:1rem}#content blockquote li{list-style:disc}#content table{width:100%;border-collapse:collapse;margin:1rem 0;overflow-x:auto}#content table th{font-size:.9rem}#content table td,#content table th{padding:2px 5px;text-align:center;border:1px solid #ccc}#content li{line-height:2;padding-left:.4rem}#content li:last-child{margin-bottom:1rem}#content ul{list-style:disc outside;padding-left:2rem}#content ol{list-style:decimal outside;padding-left:2rem}#content .gist{width:100%}#content .gist td,#content .gist th{text-align:left;border:0}#content .gist .gist-meta{background-color:transparent;color:#fff}#content .gist .gist-meta a{color:#fff}.tag{padding:.25em 0;margin-right:.5em;opacity:.6}.grid{display:grid;grid-gap:20px;grid-template-columns:repeat(auto-fit,minmax(400px,1fr));grid-auto-rows:400px}@media screen and (max-width:736px){.grid{grid-template-columns:repeat(auto-fit,minmax(100%,1fr))}}.grid>div{background-color:transparent;overflow:hidden}.grid>div>img{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;opacity:1}.grid>div>a>img{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;opacity:1}.go-left{justify-content:flex-start;align-items:flex-start}.go-right{justify-content:flex-end;align-items:flex-end}.go-center{justify-content:center;align-items:center}
1+
*{margin:0;padding:0;box-sizing:border-box}html{background-color:#39424e;font-family:didact gothic,sans serif;font-size:16px}body{font-size:16px;font-family:didact gothic,sans serif;color:#fff;line-height:2rem;letter-spacing:1.5px;text-shadow:none;display:flex;flex-direction:column;justify-content:space-between;align-items:center;opacity:1;padding:6em 1em}@media screen and (max-width:736px){body{padding:3em 1em}}h1,h2,h3{margin-bottom:.5em;font-family:didact gothic,sans-serif;opacity:.6}li{opacity:.8}li a{opacity:.9}ul{list-style-type:none}p{display:inline;opacity:.8}a{color:#ccc;text-decoration:none;border-bottom:2px solid #ccc;transition:.5s ease}a:hover{color:#fff;font-style:none}a:active{color:#ccc}button{padding:20px;border:0;border-radius:5px;background:#fff}button:hover{box-shadow:5px 5px #111}hr{margin:1rem 0;background-color:transparent;width:50%;border-style:solid;border-width:1px;opacity:.3}nav{margin:1em auto}.wrap{margin:0 auto;width:45%;max-width:64em}@media screen and (max-width:736px){.wrap{width:100%}}.tag-container{display:flex;flex-direction:row;justify-content:flex-start;align-items:center}.tag{background-color:transparent;position:relative;bottom:0}.flex-container{display:flex;flex-direction:column;justify-content:center;align-items:flex-start}.bottom-menu{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.footer{width:100%;display:flex;justify-content:center;align-items:center;text-align:center;background-color:transparent;position:relative;bottom:0;padding:1rem;font-family:didact gothic,sans serif;font-size:1rem;line-height:1em;opacity:.8}.footer a{border-bottom:none;display:contents}#splash{margin:auto 0;height:100vh;width:45%;overflow:hidden}@media screen and (max-width:736px){#splash{width:90%}}.big-link{font-family:didact gothic,sans serif;font-size:3rem;font-weight:300;margin-bottom:2rem;line-height:1.5em}#title{margin-top:3rem;font-family:didact gothic,sans serif;font-size:2rem;line-height:3rem;margin-bottom:2rem}article{width:100%;line-height:2em;letter-spacing:2px}article div{width:100%;height:100%;margin-bottom:1em}article h1,article h2,article h3{margin:1em 0;text-align:left}article p{display:block;margin-bottom:1em;line-height:1.6;letter-spacing:1.5px;opacity:.8}article .highlight{width:100%}article pre{line-height:2rem;border-radius:3px;padding:1rem;overflow-x:auto;background-color:#000004;width:100%;margin-bottom:1em}article pre>code{border:none}article code{font-size:.9rem;font-family:source code pro,monospace;padding:.1rem;border-radius:3px;border:1px solid #ccc}article img{width:100%;max-width:100%;display:block;margin:2rem auto;opacity:1}article blockquote{background-color:#ccc;color:#39424e;padding:2rem;margin:2rem 1rem;border-radius:3px}article blockquote a{color:#111}article blockquote ul{margin-top:1rem}article blockquote li{list-style:disc}article table{width:100%;border-collapse:collapse;margin:1rem 0;overflow-x:auto}article table th{font-size:.9rem}article table td,article table th{padding:2px 5px;text-align:center;border:1px solid #ccc}article li{line-height:2;padding-left:.4rem}article li:last-child{margin-bottom:1rem}article ul{list-style:disc outside;padding-left:2rem}article ol{list-style:decimal outside;padding-left:2rem}article .gist{max-width:100%}article .gist td,article .gist th{text-align:left;border:0}article .gist .gist-meta{background-color:transparent;color:#fff}article .gist .gist-meta a{color:#fff}.tag{padding:.25em 0;margin-right:.5em;opacity:.6}.grid{margin:1em auto;display:grid;grid-gap:20px;grid-template-columns:repeat(auto-fit,minmax(400px,1fr));grid-auto-rows:400px}@media screen and (max-width:736px){.grid{grid-template-columns:repeat(auto-fit,minmax(100%,1fr))}}.grid>div{background-color:transparent;overflow:hidden}.grid>div>img{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;opacity:1}.grid>div>a>img{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;opacity:1}.go-left{justify-content:flex-start;align-items:flex-start}.go-right{justify-content:flex-end;align-items:flex-end}.go-center{justify-content:center;align-items:center}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Target":"css/main.min.81bbafc4df93b11c1c3e2449464373c384aa4903731b4fc7a77dfcdd979e184f.css","MediaType":"text/css","Data":{"Integrity":"sha256-gbuvxN+TsRwcPiRJRkNzw4SqSQNzG0/Hp3383ZeeGE8="}}
1+
{"Target":"css/main.min.4321edce0de245f4b1d32680d89ac669940fe5dec17e1791c721d9a0954987b4.css","MediaType":"text/css","Data":{"Integrity":"sha256-QyHtzg3iRfSx0yaA2JrGaZQP5d7BfheRxyHZoJVJh7Q="}}

layouts/_default/baseof.html

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,29 @@
1717
</head>
1818

1919
<body>
20-
{{ block "main" . }}<div class="wrap">
21-
{{ block "section_title" . }}<div class="section" id="title">{{ .Title }}</div>{{ end }}
22-
23-
{{ block "section_content" . }}<div class="section" id="content">{{ .Content }}</div>{{ end }}
20+
{{ block "main" . }}
21+
{{ block "section_title" . }}
22+
<header class="wrap flex-container">
23+
<h1>{{ .Title }}</h1>
24+
</header>
25+
{{ end }}
26+
<main class="wrap">
27+
{{ block "section_content" . }}
28+
<article role="article" class="flex-container">{{ .Content }}</article>
29+
{{ end }}
2430

2531
{{ block "bottom-menu" . }}
26-
{{ if .Site.Params.mainMenu }}<div class="section bottom-menu">{{ partial "bottom_menu.html" (dict "Page" . "show_back_menu_item" false) }}</div>{{ end }}
32+
{{ if .Site.Params.mainMenu }}
33+
<nav role="navigation" class="flex-container bottom-menu">
34+
{{ partial "bottom_menu.html" (dict "Page" . "show_back_menu_item" false) }}
35+
</nav>
2736
{{ end }}
28-
29-
{{ block "footer" . }}<div class="section footer">{{ partial "footer.html" . }}</div>{{ end }}
30-
</div>{{ end }}
37+
{{ end }}
38+
</main>
39+
{{ block "footer" . }}
40+
<footer class="flex-container footer">{{ partial "footer.html" . }}</footer>
41+
{{ end }}
42+
{{ end }}
3143
</body>
3244

3345
</html>

layouts/_default/list.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{{ define "section_content" }}
2-
<div class="section" id="content">
2+
<article class="flex-container">
33
{{ .Content }}
4+
</article>
5+
<nav role="navigation">
46
<ul>
57
{{ range .Data.Pages }}
68
<li>
79
{{ if .Params.showDate }}
8-
910
{{ .Date.Format (.Site.Params.dateForm | default "Mon Jan 02, 2006")}} --
10-
1111
{{ end }}
1212
<a href="{{.RelPermalink}}">
1313
{{.Title}}
1414
</a>
1515
</li>
1616
{{ end }}
1717
</ul>
18-
</div>
18+
</nav>
1919
{{ end }}

layouts/gallery/list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ define "section_content" }}
2-
<div class="section" id="content">
2+
<article role="article" class="flex-container">
33
{{ .Content }}
4-
</div>
4+
</article>
55

66
{{ if .Params.clickablePhotos }}
77
<div class="grid">

0 commit comments

Comments
 (0)