Skip to content

Commit d992273

Browse files
authored
fix: change color for blog time tag to pass the accessibility test on lighthouse (#15)
1 parent 679d333 commit d992273

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

assets/javascript/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
5151
const postText = entity.getElementsByTagName("description")[0].textContent.replace('src="/', `src="${params.blog.url}/`);
5252
const regex = /<div class="featured-image">\n.+\n.+<\/div>/g;
5353
const postImage = postText.match(regex);
54+
const postImageWithAlt = String(postImage).replace("img", "img alt='Blog post hero image'");
5455
const postDescription = postText.replace(regex, '');
5556
let editedPostText = postDescription.split(' ', 60).join(' ');
5657
if (postDescription.split(' ').length > 60) {
@@ -71,7 +72,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
7172
</div>
7273
</div>
7374
<div class="uk-card-media-top">
74-
${postImage}
75+
${postImageWithAlt}
7576
</div>
7677
<div class="uk-card-body">
7778
<p>${editedPostText}</p>

assets/scss/main.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ span.category-header {
183183
.posts, .repos {
184184
div.uk-card-header {
185185
border: none;
186+
187+
time {
188+
color: #767676;
189+
}
186190
}
187191

188192
h3.uk-card-title b {

exampleSite/data/content.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ projects:
121121
name: Developer Resume
122122

123123
blog:
124-
enable: False
124+
enable: True
125125
url: https://lifelongstudent.io
126126
sitemapUrl: https://lifelongstudent.io/index.xml
127-
numberOfPosts: 2
127+
numberOfPosts: 4
128128

129129
talks:
130130
enable: True

layouts/partials/_banner.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</button>
2626

2727
<!-- This is an anchor toggling the off-canvas -->
28-
<a href="#mobile-banner" uk-toggle><p style="display: none">Mobile toggle button</p></a>
28+
<a href="#mobile-banner" uk-toggle></a>
2929

3030
<!-- This is the off-canvas -->
3131
<div id="mobile-banner" uk-offcanvas>

0 commit comments

Comments
 (0)