From 1e9f9c10e0db42dbb08db3404f12a2bfbeabfd0c Mon Sep 17 00:00:00 2001 From: Sanyam Kapoor Date: Sun, 8 Dec 2024 03:28:27 -0500 Subject: [PATCH] seed thoughts section for micro-blogging --- src/components/THtml.astro | 136 +++++++++++++++++++++++++++ src/content/config.ts | 9 ++ src/content/thoughts/202411220003.md | 5 + src/content/thoughts/202411241132.md | 5 + src/content/thoughts/202411241143.md | 7 ++ src/content/thoughts/202411241331.md | 9 ++ src/content/thoughts/202411241510.md | 10 ++ src/content/thoughts/202411241629.md | 5 + src/pages/thoughts/[page].astro | 128 +++++++++++++++++++++++++ src/pages/thoughts/index.astro | 3 + 10 files changed, 317 insertions(+) create mode 100644 src/components/THtml.astro create mode 100644 src/content/thoughts/202411220003.md create mode 100644 src/content/thoughts/202411241132.md create mode 100644 src/content/thoughts/202411241143.md create mode 100644 src/content/thoughts/202411241331.md create mode 100644 src/content/thoughts/202411241510.md create mode 100644 src/content/thoughts/202411241629.md create mode 100644 src/pages/thoughts/[page].astro create mode 100644 src/pages/thoughts/index.astro diff --git a/src/components/THtml.astro b/src/components/THtml.astro new file mode 100644 index 0000000..7f6958f --- /dev/null +++ b/src/components/THtml.astro @@ -0,0 +1,136 @@ +--- +import { getEntry } from "astro:content"; +import { PiTreeBold } from "react-icons/pi"; +import { TfiThought } from "react-icons/tfi"; +import { IoSearch } from "react-icons/io5"; + +import Goatcounter from "./Goatcounter.astro"; + +import "@styles/main.css"; + +const { + frontmatter: { title, description, area, date, updated, keywords, authors }, +} = Astro.props; + +const canonicalURL = new URL(Astro.url.pathname, import.meta.env.SITE); + +const { + data: { name: siteAuthorName }, +} = await getEntry("authors", "sk"); +--- + + + + + + + + + + + + + + + + + {title} | {siteAuthorName} + + + + + + + + + { + date ? ( + + ) : null + } + + { + updated ? ( + + ) : null + } + + + + + + +
+ +
+ + + + + diff --git a/src/content/config.ts b/src/content/config.ts index 7e7a8de..838df31 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -35,6 +35,14 @@ const kb = defineCollection({ }), }); +const thoughts = defineCollection({ + type: "content", + schema: z.object({ + date: z.coerce.date(), + authors: z.array(reference("authors")).optional().default(["sk"]), + }), +}); + const social = defineCollection({ type: "data", schema: z.object({ @@ -48,4 +56,5 @@ export const collections = { kb, overview: kb, social, + thoughts, }; diff --git a/src/content/thoughts/202411220003.md b/src/content/thoughts/202411220003.md new file mode 100644 index 0000000..89f5ca0 --- /dev/null +++ b/src/content/thoughts/202411220003.md @@ -0,0 +1,5 @@ +--- +date: Nov 22 2024, 00:03 -0500 +--- + +[Cricket](https://en.wikipedia.org/wiki/Cricket) is probably the only sport which has a formalized lunch break. diff --git a/src/content/thoughts/202411241132.md b/src/content/thoughts/202411241132.md new file mode 100644 index 0000000..6fb069f --- /dev/null +++ b/src/content/thoughts/202411241132.md @@ -0,0 +1,5 @@ +--- +date: Nov 24 2024, 11:32 -0500 +--- + +Indian pedagogy is culturally submissive. The _Guru-Shishya_ dynamic has such a strong grip on headspace. In the West, I've always sensed that students operate with a far more sense of agency whereas I have operated with a sense of submissive confidence. diff --git a/src/content/thoughts/202411241143.md b/src/content/thoughts/202411241143.md new file mode 100644 index 0000000..4143184 --- /dev/null +++ b/src/content/thoughts/202411241143.md @@ -0,0 +1,7 @@ +--- +date: Nov 24 2024, 11:43 -0500 +--- + +What is the phenomenon of people wanting something but then not showing up called? + +For instance, movie studios after all the cry of dying theaters just eventually end up releasing movies on streaming platforms instead. We are stuck in a vicious cycle - studios don't release in theaters because people don't go; people don't go to theaters because studios release on streaming. diff --git a/src/content/thoughts/202411241331.md b/src/content/thoughts/202411241331.md new file mode 100644 index 0000000..a6f3413 --- /dev/null +++ b/src/content/thoughts/202411241331.md @@ -0,0 +1,9 @@ +--- +date: Nov 24 2024, 13:31 -0500 +--- + +The boring movie disclaimer, + +> This is a work of fiction. Any similarity to actual persons, living or dead, or actual events, is purely coincidental. + +can be traced back to [Rasputin](https://slate.com/culture/2016/08/the-bizarre-true-story-behind-the-this-is-a-work-of-fiction-disclaimer.html). diff --git a/src/content/thoughts/202411241510.md b/src/content/thoughts/202411241510.md new file mode 100644 index 0000000..3c48c9e --- /dev/null +++ b/src/content/thoughts/202411241510.md @@ -0,0 +1,10 @@ +--- +date: Nov 24 2024, 15:10 -0500 +--- + +There is only one kind of mindset that moves society forward - the one of an artist. + +Actors, musicians, writers, and all the like, quite obviously qualify. +But good scientists play the same way. Good businessmen have all at one point been artful. + +What entails this mindset is the drive to follow through on their ideas with bravado. diff --git a/src/content/thoughts/202411241629.md b/src/content/thoughts/202411241629.md new file mode 100644 index 0000000..e810e6c --- /dev/null +++ b/src/content/thoughts/202411241629.md @@ -0,0 +1,5 @@ +--- +date: Nov 24 2024, 16:29 -0500 +--- + +Asking for advice from an artist is as good as asking a writer what dictionary they refer to. diff --git a/src/pages/thoughts/[page].astro b/src/pages/thoughts/[page].astro new file mode 100644 index 0000000..fb177ba --- /dev/null +++ b/src/pages/thoughts/[page].astro @@ -0,0 +1,128 @@ +--- +import { getCollection } from "astro:content"; + +import THtml from "@components/THtml.astro"; +import Date from "@components/Date.astro"; + +export async function getStaticPaths({ paginate }) { + const thoughts = await getCollection("thoughts"); + return paginate(thoughts.reverse(), { pageSize: 20 }); +} + +export const prerender = true; + +const frontmatter = { + title: "Muddle of Thoughts", + description: "Random, incoherent ramblings.", +}; + +const { + page: { currentPage, data, url }, +} = Astro.props; +--- + + +
+
+

{frontmatter.title}

+

+ {frontmatter.description} +

+
+
+
+ { + data.map(async (page) => { + const { Content } = await page.render(); + const { + data: { date }, + } = page; + return ( +
+ +
+ + +
+
+ ); + }) + } +
+
+ +
+
+ + diff --git a/src/pages/thoughts/index.astro b/src/pages/thoughts/index.astro new file mode 100644 index 0000000..9ebf652 --- /dev/null +++ b/src/pages/thoughts/index.astro @@ -0,0 +1,3 @@ +--- +return Astro.redirect("/thoughts/1", 307); +---