diff options
| author | Kyren223 <Kyren223@proton.me> | 2024-11-13 12:59:05 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2024-11-13 12:59:05 +0200 |
| commit | face4ce2d0e2316c9ed62b2eba9260a17e39572f (patch) | |
| tree | d15f5913fd585be287f7a3ad57ca49806ae2e6c4 /src/pages/blogs/index.astro | |
| parent | 5f18abf234a80b45ed6d1fd935c2f60b2599b87f (diff) | |
Backup
Diffstat (limited to 'src/pages/blogs/index.astro')
| -rw-r--r-- | src/pages/blogs/index.astro | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/pages/blogs/index.astro b/src/pages/blogs/index.astro deleted file mode 100644 index e91e580..0000000 --- a/src/pages/blogs/index.astro +++ /dev/null @@ -1,50 +0,0 @@ ---- -import Layout from "../../layouts/Layout.astro"; -import TerminalBorder from "../../components/TerminalBorder.astro"; -import BlogItem from "../../components/BlogItem.astro"; -import { getCollection } from "astro:content"; - -function formatDate(date) { - const day = date.getDate(); - const month = date.toLocaleString("default", { month: "long" }); // Get full month name - const year = date.getFullYear(); - - let suffix = "th"; - if (day === 1 || day === 21 || day === 31) { - suffix = "st"; - } else if (day === 2 || day === 22) { - suffix = "nd"; - } else if (day === 3 || day === 23) { - suffix = "rd"; - } - - return `${month} ${day}${suffix} ${year}`; -} - -const blogs = (await getCollection("blogs")).map((blog) => ({ - title: blog.data.title, - description: blog.data.description, - date: formatDate(blog.data.date), - href: "/blogs/" + blog.slug, -})); ---- - -<Layout dir="blogs/"> - <TerminalBorder header="Shell" margin="0.5rem 0 20px"> - <p>ls ~/blogs {blogs.length}</p> - </TerminalBorder> - <div class="max-h-[18.5rem] overflow-y-auto"> - { - blogs.map((blog) => ( - <> - <BlogItem - title={blog.title} - description={blog.description} - date={blog.date} - href={blog.href} - /> - </> - )) - } - </div> -</Layout> |
