Files
site-profile/src/pages/blog/index.astro
Alex Lebens 500d9e2ea0
All checks were successful
renovate / renovate (push) Successful in 41s
test-build / build (push) Successful in 1m25s
test-build / guarddog (push) Successful in 1m43s
feat: move script handling to use swup instead of astro transitions, move animations to baselayout
2026-03-13 10:59:25 -05:00

60 lines
1.5 KiB
Plaintext

---
import { readItems, readSingleton } from '@directus/sdk';
import type { Post } from '@lib/directusTypes';
import HeroSection from '@components/sections/HeroSection.astro';
import SelectedPostsSection from '@components/sections/SelectedPostsSection.astro';
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
import BaseLayout from '@layouts/BaseLayout.astro';
import directus from '@lib/directus';
const global = await directus.request(readSingleton('site_global'));
const posts = await directus.request(
readItems('posts', {
filter: { published: { _eq: true } },
fields: ['*', { category: ['*'] }],
sort: ['-published_date'],
})
);
const selectedPosts: Post[] = posts.filter((p) => p.selected).slice(0, 4);
const recentPosts: Post[] = posts.filter(
(p) => !selectedPosts.some((selected) => selected.slug === p.slug)
).slice(0, 9);
---
<BaseLayout
title="Blog"
description={global.about_blog}
structuredData={{
'@context': 'https://schema.org',
'@type': 'WebPage',
inLanguage: 'en-US',
'@id': Astro.url.href,
url: Astro.url.href,
name: `Blog | ${global.name}`,
description: global.about_blog,
isPartOf: {
'@type': 'WebSite',
url: global.site_url,
name: global.name,
description: global.about,
},
}}
>
<HeroSection
title="Blog"
subTitle={global.about_blog}
/>
<SelectedPostsSection posts={selectedPosts} />
<RecentPostsSection
posts={recentPosts}
title="Recent Posts"
/>
</BaseLayout>