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 {
|
const { entry } = Astro.props as {
|
||||||
entry: CollectionEntry<"blog"> | CollectionEntry<"projects">;
|
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
|
<a
|
||||||
|
|
@ -19,7 +25,7 @@ const { entry } = Astro.props as {
|
||||||
{entry.data.title}
|
{entry.data.title}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm">
|
<div class="text-sm">
|
||||||
{entry.data.description}
|
<span class="font-mono text-xs opacity-60">{datePrefix}</span>{entry.data.description}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<svg
|
<svg
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,17 @@ const computedPageId = pageId ?? Astro.url.pathname;
|
||||||
[500, 1000, 2000, 3000].forEach(delay => {
|
[500, 1000, 2000, 3000].forEach(delay => {
|
||||||
setTimeout(hideReactionText, 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>
|
</script>
|
||||||
|
|
||||||
<style is:inline>
|
<style is:inline>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue