Highlight recent post dates on homepage and article metadata (#793)

- Display post dates on homepage.

This helps make recent articles more noticeable. The highlight is applied
to post dates less than 48 hours old on the client side.
This commit is contained in:
Hugo Locurcio
2024-02-05 06:26:17 +01:00
committed by GitHub
parent 1c7817d3a2
commit 973cf2b1c2
4 changed files with 42 additions and 1 deletions

View File

@@ -82,6 +82,13 @@
hljs.highlightBlock(block);
});
document.querySelectorAll('[data-post-date]').forEach((postDate) => {
// Highlight post dates that are less than 48 hours old.
if (Date.parse(postDate.dataset.postDate) > (Date.now() - 1000 * 60 * 60 * 96)) {
postDate.classList.add("post-recent-highlight");
};
});
// Initialize lightbox.
new Tobii({
zoom: false,