46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
---
|
|
import PostHero from "../components/PostHero.astro";
|
|
import PostFooter from "../components/PostFooter.astro";
|
|
import { getFeaturedPosts, invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
|
import { Markup } from 'astro-remote';
|
|
import * as render from '../components/astro-remote';
|
|
|
|
export type Props = {
|
|
post: Post;
|
|
settings: Settings;
|
|
posts: Post[];
|
|
};
|
|
|
|
const { post, settings, posts } = Astro.props as Props;
|
|
|
|
async function getPostsSet(){
|
|
const featuredPosts = await getFeaturedPosts();
|
|
const fposts = posts;
|
|
if(featuredPosts.posts.length === 0){ return fposts }
|
|
else {
|
|
const featured = featuredPosts.posts[0]
|
|
return fposts.filter((p: Post)=>p.id !== featured.id)
|
|
}
|
|
}
|
|
|
|
const mPosts = await getPostsSet()
|
|
|
|
invariant(settings, "Settings not found");
|
|
---
|
|
|
|
<PostHero post={post} settings={settings} />
|
|
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
|
|
<Markup
|
|
content={post.html}
|
|
sanitize={{
|
|
allowComponents: true,
|
|
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
|
|
}}
|
|
components={{
|
|
pre: render.CodeSlot
|
|
}}
|
|
/>
|
|
</div>
|
|
<PostFooter post={post} settings={settings} posts={mPosts} />
|
|
|