diff --git a/src/components/BookReview.astro b/src/components/BookReview.astro new file mode 100644 index 0000000..cb2c795 --- /dev/null +++ b/src/components/BookReview.astro @@ -0,0 +1,166 @@ +--- +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}

+ ) + } +
diff --git a/src/content/bookReview/coevolution.md b/src/content/bookReview/coevolution.md new file mode 100644 index 0000000..01ddf9a --- /dev/null +++ b/src/content/bookReview/coevolution.md @@ -0,0 +1,30 @@ +--- +title: The Coevolution +summary: The Coevolution kitabının incelemesi. +category: fikir +subcategory: Kitap İncelemesi +date: 2024-07-25 +bookAuthor: Edward Ashford Lee +publisher: The MIT Press +bookLanguage: İngilizce +bookGenre: Teknoloji Felsefesi +bookCover: ../../images/thecoevolution.jpg +--- + + + +

+Kitap, makineler ile insanlar arasındaki ilişkiye odaklanıyor ve bu ilişkiyi genellikle yapılanın aksine, makineler açısından ele almaya çalışıyor. Kitaba göre, makineler de aslında bir tür canlıdır; ancak insanlar yalnızca "dijital" türde canlılar üretebildiği için, biyolojik canlılar gibi makinelerin de dijital canlılar (LDB: Digital Living Beings) olduğunu algılayamıyorlar. +

+ +

+Makineler, insanlar için bir tür protez işlevi görüyor. Bu protezler, genellikle geri bildirim mekanizmalarına dayanarak sürekli olarak kendilerini geliştiriyorlar. Hatta birçok makineyi, bir geri bildirim mekanizması olarak değerlendirmek mümkün. Bu durum, bazen -dil modellerinde olduğu gibi- davranışlarını açıklayabilmemizin önüne geçebiliyor. Ancak, insanlar uydurma pahasına da olsa her şeyi açıklama ihtiyacı hissettiği için, yapacağımız açıklamaların nitel bir getirisi olmayabilir. +

+ +

+Yazar ayrıca, insanın ne ölçüde taklit edilebileceğine de değiniyor. İnsan, büyük ölçüde analog bir yapıya sahip olduğu için, "bit bitine" kopyalanması mümkün görünmüyor. Ayrıca, bu sistemlerin yaptıklarından kimi sorumlu tutacağımız da bir muamma. Özetle, makineler evrimimizin bir parçası, belki bir gün gelecek, kendimizi onların da kendi kendilerine evrildiği bir süreçte bulacağız. +

diff --git a/src/content/config.ts b/src/content/config.ts index e35c75f..010ea19 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -2,18 +2,36 @@ import { z, defineCollection } from "astro:content"; export const CATEGORIES = ["fikir", "teknik", "edebiyat", "ansiklopedi"]; +const blogPostSchema = z.object({ + title: z.string(), + tags: z.optional(z.array(z.string())), + summary: z.string(), + date: z.date(), + category: z.enum(["fikir", "teknik", "edebiyat", "ansiklopedi"]), + subcategory: z.string(), +}); + +const bookReviewSchema = blogPostSchema.extend({ + bookAuthor: z.string(), + publisher: z.string(), + bookLanguage: z.string(), + bookGenre: z.string(), +}); + const blogCollection = defineCollection({ type: "content", - schema: z.object({ - title: z.string(), - tags: z.optional(z.array(z.string())), - summary: z.string(), - date: z.date(), - category: z.enum(["fikir", "teknik", "edebiyat", "ansiklopedi"]), - subcategory: z.string(), - }), + schema: blogPostSchema, +}); + +const bookReviewCollection = defineCollection({ + type: "content", + schema: ({ image }) => + bookReviewSchema.extend({ + bookCover: image(), + }), }); export const collections = { blog: blogCollection, + bookReview: bookReviewCollection, }; diff --git a/src/images/thecoevolution.jpg b/src/images/thecoevolution.jpg new file mode 100644 index 0000000..2908135 Binary files /dev/null and b/src/images/thecoevolution.jpg differ diff --git a/src/pages/[category]/[page]/index.astro b/src/pages/[category]/[page]/index.astro index 8e5b635..f360ed6 100644 --- a/src/pages/[category]/[page]/index.astro +++ b/src/pages/[category]/[page]/index.astro @@ -10,10 +10,13 @@ import Post from "@/components/Post.astro"; export async function getStaticPaths({ paginate }: { paginate: any }) { const blogEntries = await getCollection("blog"); + const allReviews = await getCollection("bookReview"); + + const allPosts = [...allReviews, ...blogEntries]; return CATEGORIES.flatMap((category) => { - const filteredPosts = blogEntries.filter( - (post) => post.data.category == category, + const filteredPosts = allPosts.filter( + (post) => post.data.category == category ); return paginate(filteredPosts, { params: { category }, diff --git a/src/pages/[category]/[slug]/index.astro b/src/pages/[category]/[slug]/index.astro index 3e9f862..1f62fe6 100644 --- a/src/pages/[category]/[slug]/index.astro +++ b/src/pages/[category]/[slug]/index.astro @@ -8,6 +8,7 @@ import Post from "@/components/Post.astro"; import EmojiReactionForm from "@/components/EmojiReactionForm.astro"; import CommentForm from "@/components/CommentForm.astro"; import HorizontalLine from "@/components/HorizontalLine.astro"; +import BookReview from "@/components/BookReview.astro"; const { entry } = Astro.props; @@ -15,8 +16,11 @@ const backendHost = import.meta.env.PUBLIC_BACKEND_HOST; export async function getStaticPaths() { const blogEntries = await getCollection("blog"); + const allReviews = await getCollection("bookReview"); - return blogEntries.map((entry) => ({ + const allPosts = [...allReviews, ...blogEntries]; + + return allPosts.map((entry) => ({ params: { category: entry.data.category, slug: entry.slug }, props: { entry }, })); @@ -25,7 +29,13 @@ export async function getStaticPaths() {
- + { + entry.collection === "blog" ? ( + + ) : ( + + ) + }
diff --git a/src/pages/index.astro b/src/pages/index.astro index 9e979b0..4c734a3 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -5,17 +5,28 @@ import Layout from "@/layouts/Layout.astro"; import { getCollection } from "astro:content"; import Post from "@/components/Post.astro"; +import BookReview from "@/components/BookReview.astro"; const allTeknikPosts = await getCollection("blog"); +const allReviews = await getCollection("bookReview"); + +const allPosts = [...allReviews, ...allTeknikPosts]; ---
{ - allTeknikPosts + allPosts .sort((p1, p2) => p2.data.date.getTime() - p1.data.date.getTime()) - .map((p) => ) + .map((p) => { + if (p.collection == "blog") { + return ; + } else { + p.collection == "bookReview"; + return ; + } + }) }
Tüm Yayınlar