2024-05-07 16:35:30 +00:00
|
|
|
|
---
|
2024-05-11 17:08:36 +00:00
|
|
|
|
import type { CollectionEntry } from "astro:content";
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
post: CollectionEntry<"blog">;
|
|
|
|
|
componentType: "short" | "long" | "full";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { post, componentType } = Astro.props;
|
|
|
|
|
|
2024-05-12 08:45:41 +00:00
|
|
|
|
let showTags, shortSummary, longSummary, fullText, postFooter;
|
2024-05-11 17:08:36 +00:00
|
|
|
|
|
|
|
|
|
switch (componentType) {
|
|
|
|
|
case "full":
|
2024-05-12 08:45:41 +00:00
|
|
|
|
postFooter = true;
|
|
|
|
|
showTags = true;
|
2024-05-11 17:08:36 +00:00
|
|
|
|
fullText = true;
|
|
|
|
|
break;
|
|
|
|
|
case "long":
|
|
|
|
|
longSummary = true;
|
|
|
|
|
showTags = true;
|
|
|
|
|
break;
|
|
|
|
|
case "short":
|
|
|
|
|
shortSummary = true;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-05-12 07:48:06 +00:00
|
|
|
|
|
|
|
|
|
const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", {
|
|
|
|
|
day: "numeric",
|
|
|
|
|
month: "long",
|
|
|
|
|
year: "numeric",
|
|
|
|
|
});
|
2024-05-12 08:45:41 +00:00
|
|
|
|
|
2024-05-13 07:28:52 +00:00
|
|
|
|
const base = import.meta.env.BASE_URL;
|
|
|
|
|
|
|
|
|
|
const postLink = `${base}/category/${post.data.category}/${post.slug}`;
|
2024-05-12 09:21:45 +00:00
|
|
|
|
|
2024-05-12 08:45:41 +00:00
|
|
|
|
const { Content } = await post.render();
|
2024-05-07 16:35:30 +00:00
|
|
|
|
---
|
|
|
|
|
|
2024-05-11 16:24:15 +00:00
|
|
|
|
<style>
|
2024-05-12 07:48:06 +00:00
|
|
|
|
.meta-list li {
|
|
|
|
|
padding-top: 0.1rem;
|
|
|
|
|
&:not(:last-child) {
|
|
|
|
|
&:after {
|
|
|
|
|
content: ",\00a0";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-11 16:24:15 +00:00
|
|
|
|
</style>
|
|
|
|
|
|
2024-05-16 11:14:54 +00:00
|
|
|
|
<div class="flex flex-col gap-3">
|
|
|
|
|
<div class="flex flex-col">
|
|
|
|
|
<p class="tracking-wide text-slate-700">{post.data.subcategory}</p>
|
|
|
|
|
<a class="no-underline text-inherit" href={postLink}
|
|
|
|
|
><h4 class="text-3xl font-normal">{post.data.title}</h4></a
|
2024-05-12 09:21:45 +00:00
|
|
|
|
>
|
2024-05-16 11:14:54 +00:00
|
|
|
|
<div class="flex flex-row gap-2">
|
2024-05-11 17:08:36 +00:00
|
|
|
|
{
|
2024-05-12 07:48:06 +00:00
|
|
|
|
showTags && (
|
2024-05-16 11:14:54 +00:00
|
|
|
|
<div class="flex items-center gap-1">
|
2024-05-12 07:48:06 +00:00
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
width="18"
|
|
|
|
|
height="18"
|
|
|
|
|
fill="#6d6d6d"
|
|
|
|
|
viewBox="0 0 256 256"
|
|
|
|
|
>
|
|
|
|
|
<path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z" />
|
|
|
|
|
</svg>
|
2024-05-16 11:14:54 +00:00
|
|
|
|
<ul class="list-none flex pl-0 meta-list">
|
2024-05-12 07:48:06 +00:00
|
|
|
|
{post.data.tags.map((tag) => (
|
2024-05-16 11:14:54 +00:00
|
|
|
|
<li class="text-sm text-gray-500">{tag}</li>
|
2024-05-12 07:48:06 +00:00
|
|
|
|
))}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
2024-05-11 17:08:36 +00:00
|
|
|
|
}
|
2024-05-12 07:48:06 +00:00
|
|
|
|
|
2024-05-16 11:14:54 +00:00
|
|
|
|
<div class="flex items-center gap-1">
|
2024-05-12 07:48:06 +00:00
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
width="18"
|
|
|
|
|
height="18"
|
|
|
|
|
fill="#6d6d6d"
|
|
|
|
|
viewBox="0 0 256 256"
|
|
|
|
|
><path
|
|
|
|
|
d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-68-76a12,12,0,1,1-12-12A12,12,0,0,1,140,132Zm44,0a12,12,0,1,1-12-12A12,12,0,0,1,184,132ZM96,172a12,12,0,1,1-12-12A12,12,0,0,1,96,172Zm44,0a12,12,0,1,1-12-12A12,12,0,0,1,140,172Zm44,0a12,12,0,1,1-12-12A12,12,0,0,1,184,172Z"
|
|
|
|
|
></path></svg
|
|
|
|
|
>
|
2024-05-16 11:14:54 +00:00
|
|
|
|
<ul class="list-none flex pl-0 meta-list">
|
|
|
|
|
<p class="text-sm text-gray-500">{postDateFormatted}</p>
|
2024-05-12 07:48:06 +00:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-05-11 17:08:36 +00:00
|
|
|
|
</div>
|
2024-05-12 08:45:41 +00:00
|
|
|
|
{shortSummary && <p class="post-summary">{post.data.summary}</p>}
|
2024-05-11 17:08:36 +00:00
|
|
|
|
|
2024-05-12 07:48:06 +00:00
|
|
|
|
{
|
|
|
|
|
longSummary && (
|
|
|
|
|
<>
|
2024-05-12 09:21:45 +00:00
|
|
|
|
<p class="post-long-summary">
|
|
|
|
|
{post.body.slice(0, 500).replace(/(<([^>]+)>)/gi, "")}
|
|
|
|
|
</p>
|
2024-05-12 07:48:06 +00:00
|
|
|
|
{post.body.length > 500 && (
|
2024-05-12 08:45:41 +00:00
|
|
|
|
<a
|
2024-05-16 11:14:54 +00:00
|
|
|
|
class="text-inherit text-sm"
|
2024-05-13 07:28:52 +00:00
|
|
|
|
href={`${base}/category/${post.data.category}/${post.slug}`}
|
2024-05-12 08:45:41 +00:00
|
|
|
|
>
|
2024-05-12 07:48:06 +00:00
|
|
|
|
Devamını Oku
|
|
|
|
|
</a>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
2024-05-12 08:45:41 +00:00
|
|
|
|
{
|
|
|
|
|
fullText && (
|
|
|
|
|
<div class="post-body">
|
|
|
|
|
<Content />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
2024-05-16 11:14:54 +00:00
|
|
|
|
{postFooter && <p class="text-gray-600 text-sm">{postDateFormatted}</p>}
|
2024-05-07 16:35:30 +00:00
|
|
|
|
</div>
|