A Astro blog hosted on Vercel

allow spam cow

+30 -16
+17 -3
src/components/Navigation.astro
··· 8 8 9 9 homeLink?.addEventListener('click', (event) => { 10 10 event.preventDefault(); 11 - mooAudio?.addEventListener('ended', function () { 12 - const anchor = event.target as HTMLAnchorElement; 11 + 12 + const anchor = event.target as HTMLAnchorElement; 13 + 14 + if (!mooAudio) { 13 15 window.location.href = anchor.href; 14 - }); 16 + return; 17 + } 18 + 19 + mooAudio.currentTime = 0; 20 + mooAudio?.addEventListener( 21 + 'ended', 22 + function () { 23 + window.location.href = anchor.href; 24 + }, 25 + { 26 + once: true, 27 + } 28 + ); 15 29 mooAudio?.play(); 16 30 }); 17 31 </script>
+6 -6
src/layouts/BlogPost.astro
··· 1 1 --- 2 - import type { CollectionEntry } from "astro:content"; 2 + import type { CollectionEntry } from 'astro:content'; 3 3 import { 4 4 Head, 5 5 Footer, ··· 7 7 BlueskyComments, 8 8 BandcampWishlist, 9 9 LiberaPayDonate, 10 - } from "@/components"; 11 - import { formatDate } from "@/utils"; 12 - import { Image } from "astro:assets"; 10 + } from '@/components'; 11 + import { formatDate } from '@/utils'; 12 + import { Image } from 'astro:assets'; 13 13 14 - type Props = CollectionEntry<"blog">["data"]; 14 + type Props = CollectionEntry<'blog'>['data']; 15 15 16 16 const { title, description, date, updatedDate, image } = Astro.props; 17 17 --- ··· 75 75 alt={image.alt} 76 76 width={1020} 77 77 height={510} 78 - loading={"lazy"} 78 + loading={'lazy'} 79 79 /> 80 80 ) 81 81 }
+7 -7
src/pages/blog/[...slug].astro
··· 1 1 --- 2 - import { type CollectionEntry, getCollection } from "astro:content"; 3 - import { BlogPostLayout } from "@/layouts"; 4 - import { render } from "astro:content"; 2 + import { type CollectionEntry, getCollection } from 'astro:content'; 3 + import { BlogPostLayout } from '@/layouts'; 4 + import { render } from 'astro:content'; 5 5 6 6 export async function getStaticPaths() { 7 - const posts = await getCollection("blog"); 7 + const posts = await getCollection('blog'); 8 8 return posts 9 9 .filter( 10 10 (post) => 11 - import.meta.env.ENVIRONMENT === "preview" || 11 + import.meta.env.ENVIRONMENT === 'preview' || 12 12 Boolean(post.data.isPublished) 13 13 ) 14 14 .map((post) => ({ 15 15 params: { 16 - slug: post.data.title.toLowerCase().replaceAll(" ", "-"), 16 + slug: post.data.title.toLowerCase().replaceAll(' ', '-'), 17 17 }, 18 18 props: post, 19 19 })); 20 20 } 21 - type Props = CollectionEntry<"blog">; 21 + type Props = CollectionEntry<'blog'>; 22 22 23 23 const post = Astro.props; 24 24 const { Content } = await render(post);