--- import type { CollectionEntry } from "astro:content"; interface Props { post: CollectionEntry<"bookReview">; componentType: "short" | "long" | "full"; } const { post, componentType } = Astro.props; // default options for the post component const deafultOptions = { showTags: false, shortSummary: false, longSummary: false, fullText: false, postFooter: false, }; const options = { ...deafultOptions }; // Determine which options should be applied to post switch (componentType) { case "full": options.postFooter = true; options.showTags = true; options.fullText = true; break; case "long": options.longSummary = true; options.showTags = true; break; case "short": options.shortSummary = true; break; default: break; } // Options should not mutated further Object.freeze(options); // Format date const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", { day: "numeric", month: "long", year: "numeric", }); // Create post link const postLink = `/${post.data.category}/${post.slug}`; // Create post content as an astro component const { Content } = await post.render(); const copyPost = post; copyPost.body = copyPost.body.slice(0, 500); const { Content: Summary } = await copyPost.render(); import { Image } from "astro:assets"; import questionMark from "@/images/questionMark.svg"; import calendar from "@/images/calendar.svg"; ---

{post.data.subcategory}

{post.data.title}

{ options.showTags && post.data.tags?.length && (
question mark
    {post.data.tags.map((tag) => (
  • {tag}
  • ))}
) }
calendar

    {postDateFormatted}

{options.shortSummary &&

{post.data.summary}

} { options.longSummary && ( <> {post.body.length > 500 && ( Devamını Oku )} ) } { options.fullText && (
{post.data.title}
Yazar: {post.data.bookAuthor}
Yayınevi: {post.data.publisher}
) } { options.postFooter && (

{postDateFormatted}

) }