Add date prefix to blog listings and fix Hyvor reload on navigation
- ArrowCard now shows DD/MM. prefix before post descriptions - Hyvor comments reload properly after View Transitions navigation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f4b6ed17ea
commit
393eb3f87e
2 changed files with 20 additions and 3 deletions
|
|
@ -8,6 +8,12 @@ type Props = {
|
|||
const { entry } = Astro.props as {
|
||||
entry: CollectionEntry<"blog"> | CollectionEntry<"projects">;
|
||||
};
|
||||
|
||||
// Format date as DD/MM
|
||||
const date = entry.data.date;
|
||||
const day = date.getDate().toString().padStart(2, '0');
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
const datePrefix = `${day}/${month}. `;
|
||||
---
|
||||
|
||||
<a
|
||||
|
|
@ -19,7 +25,7 @@ const { entry } = Astro.props as {
|
|||
{entry.data.title}
|
||||
</div>
|
||||
<div class="text-sm">
|
||||
{entry.data.description}
|
||||
<span class="font-mono text-xs opacity-60">{datePrefix}</span>{entry.data.description}
|
||||
</div>
|
||||
</div>
|
||||
<svg
|
||||
|
|
|
|||
|
|
@ -23,18 +23,29 @@ const computedPageId = pageId ?? Astro.url.pathname;
|
|||
if (typeof window !== 'undefined') {
|
||||
window.HYVOR_TALK_CONFIG = window.HYVOR_TALK_CONFIG || {};
|
||||
}
|
||||
|
||||
|
||||
// Hide the "What's your reaction?" text after Hyvor loads
|
||||
function hideReactionText() {
|
||||
document.querySelectorAll('.reactions-title').forEach(el => {
|
||||
el.style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Run multiple times after Hyvor loads
|
||||
[500, 1000, 2000, 3000].forEach(delay => {
|
||||
setTimeout(hideReactionText, delay);
|
||||
});
|
||||
|
||||
// Reinitialize Hyvor after View Transitions navigation (only add listener once)
|
||||
if (!window._hyvorPageLoadListenerAdded) {
|
||||
window._hyvorPageLoadListenerAdded = true;
|
||||
document.addEventListener('astro:page-load', function reloadHyvor() {
|
||||
const commentsEl = document.querySelector('hyvor-talk-comments');
|
||||
if (commentsEl && window.hyvorTalk && typeof window.hyvorTalk.reload === 'function') {
|
||||
window.hyvorTalk.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style is:inline>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue