Skip to content

Commit

Permalink
Use <time /> to display dates
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWillCom committed Aug 2, 2024
1 parent 5ff6d1e commit c0ceb00
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-zoos-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hexo-theme-cupertino': patch
---

Use `<time />` to display dates to make it more readable for browsers.
4 changes: 2 additions & 2 deletions layout/_partial/post-list.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
</div>
<% } %>
<% if (!post.no_date) { %>
<div class="time">
<time class="time" datetime="<%- moment(page.date).format() %>">
<%- moment(post.date).format(theme.date_display_format) %>
</div>
</time>
<% } %>
</div>
</a>
Expand Down
4 changes: 2 additions & 2 deletions layout/post.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<% } %>
<% if (!page.no_date) { %>
<div class="date" id="date">
<time class="date" datetime="<%- moment(page.date).format() %>">
<%- moment(page.date).format(theme.date_display_format) %>
</div>
</time>
<% } %>
<h1 class="title"><%= page.title %></h1>
Expand Down
4 changes: 1 addition & 3 deletions source/css/post-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@
line-height: 1.28577;
font-weight: 600;
letter-spacing: -0.016em;
display: flex;
justify-content: flex-start;
align-items: center;
display: block;
margin-top: 12px;
color: var(--card-time);
}
Expand Down
1 change: 1 addition & 0 deletions source/css/post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ body {
}

.date {
display: block;
color: var(--grey);
font-weight: 600;
}
Expand Down

0 comments on commit c0ceb00

Please sign in to comment.