Skip to content

Commit

Permalink
updated to v - cleaned up - added sort posts by date
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-andreuzza committed Feb 20, 2024
1 parent 0ad36d9 commit 44ea055
Show file tree
Hide file tree
Showing 13 changed files with 7,728 additions and 57 deletions.
7,666 changes: 7,666 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^2.0.1",
"@astrojs/preact": "^3.0.1",
"@astrojs/rss": "^4.0.1",
"@astrojs/sitemap": "^3.0.3",
"@astrojs/tailwind": "^5.0.3",
"@astrojs/mdx": "^2.1.1",
"@astrojs/preact": "^3.1.0",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.0.5",
"@astrojs/tailwind": "^5.1.0",
"@astrolib/seo": "^1.0.0-beta.5",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"astro": "^4.0.6",
"preact": "^10.19.3",
"tailwindcss": "^3.4.0"
"astro": "^4.4.0",
"preact": "^10.19.5",
"tailwindcss": "^3.4.1"
}
}
3 changes: 2 additions & 1 deletion src/components/entries/EntriesOne.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
const { title, url, description, pubDate, author, image, tags } = Astro.props;
---

Expand All @@ -23,7 +24,7 @@ const { title, url, description, pubDate, author, image, tags } = Astro.props;
<time datetime="2020-03-16">{pubDate}</time>
</div>
</div>
<p class="text-black mt-2 font-display text-xl">
<p class="text-black mt-2 font-display text-xl text-pretty">
{title}
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/global/Cta.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<section>
<div
class="https://microblog-theta.vercel.app/ "
class="px-8 py-12 md:px-12 mx-auto lg:pb-24 max-w-7xl lg:px-32"
>
<div class="relative bg-black p-8 lg:p-20">
<h2
Expand Down
20 changes: 11 additions & 9 deletions src/components/global/Footer.astro
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<footer class="bg-white border-t">
<div class="px-8 md:px-12 mx-auto max-w-7xl py-6 lg:px-32">
<section class=" gap-y-6 gap-x-8">
<section class="gap-y-6 gap-x-8">
<div>
<p class="text-sm text-zinc-600 lg:col-span-2 ">
© 2023 Lexington Themes. All rights reserved. <a
class="text-sm text-black hover:text-accent-400 underline"
href="https://lexingtonthemes.com/">Lexington Themes</a
> is not
affiliated with Astro or Tailwind Labs team, nor is it endorsed by or
sponsored by this ones. A free template by <a
<p
class="text-sm text-zinc-600 lg:col-span-2"
x-data="{ year: new Date().getFullYear() }"
>
© <span x-text="year"></span> Lexington Themes. All rights reserved. <a
class="text-sm text-black hover:text-accent-400 underline"
href="https://lexingtonthemes.com/">Lexington Themes</a
> is not affiliated with Astro or Tailwind Labs team, nor is it endorsed
by or sponsored by these ones. A free template by <a
class="text-sm text-black hover:text-accent-400 underline"
href="https://michaelandreuzza.com/">Michael Andreuzza</a
> This website was built with Astro &amp; Tailwind. Crafted in Åland
>. This website was built with Astro &amp; Tailwind. Crafted in Åland
Islands, Finland.
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/content/posts/1.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pubDate: 2023-07-01
pubDate: 2024-01-01
author: Alejandro Martinez
title: Because the universe needed a framework
description: "Embark on a cosmic journey with astro.js, the framework that makes interstellar development a breeze. Pair it with Tailwind CSS for a design that's out of this world"
Expand Down
2 changes: 1 addition & 1 deletion src/content/posts/2.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pubDate: 2023-07-07
pubDate: 2024-01-02
author: Charlotte Parker
title: Where utility-first meets fashion-first
description: "Unleash your inner fashionista as we explore Tailwind CSS – the runway-ready framework that believes every website deserves to strut its stuff. Glam up your astro.js projects with style!"
Expand Down
2 changes: 1 addition & 1 deletion src/content/posts/3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pubDate: 2023-07-12
pubDate: 2024-01-03
author: Giovanni Russo
title: Making static sites less static, more fantastic
description: " Say goodbye to static boredom with astro.js. This framework brings life to static sites, turning them into the cool kids of the web. Tailwind CSS joins the party for some extra flair."
Expand Down
2 changes: 1 addition & 1 deletion src/content/posts/4.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pubDate: 2023-07-18
pubDate: 2024-01-04
author: Akira Nakamura
title: Tailwind CSS and astro.js the dynamic duo of web development
description: "Join forces with the dynamic duo of web development – Tailwind CSS and astro.js. They're like Batman and Robin, but for your coding adventures. No capes required"
Expand Down
2 changes: 1 addition & 1 deletion src/content/posts/5.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pubDate: 2023-07-23
pubDate: 2024-01-05
author: Isabella Garcia
title: Because writing vanilla JS is so last season
description: "Tired of vanilla JS? Spice up your coding life with astro.js. It's the haute couture of JavaScript frameworks. Tailwind CSS adds the perfect accessory for that runway-ready look."
Expand Down
2 changes: 1 addition & 1 deletion src/content/posts/6.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pubDate: 2023-07-29
pubDate: 2024-01-06
author: Henry Thompson
title: Helping your website get googly-eyed
description: "Make Google do a double-take with Tailwind CSS's SEO magic. It's like giving your website a makeover that even the search engines can't resist. Astro.js is the wingman for this enchanting journey."
Expand Down
35 changes: 19 additions & 16 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import Hero from "@/components/landing/Hero.astro";
import Cta from "@/components/global/Cta.astro";
const allPosts = await getCollection("posts");
const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())];
// Sort posts by date in descending order (newest first)
const sortedPosts = allPosts.sort(
(a, b) => new Date(b.data.pubDate) - new Date(a.data.pubDate)
);
---

<BaseLayout>
Expand All @@ -15,7 +20,7 @@ const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())];
<ol role="list" class="flex flex-wrap gap-3">
{
tags.map((tag) => (
<li class="inline-flex items-center uppercase mx-auto hover:text-blue-500 text-xs font-medium text-black ">
<li class="inline-flex items-center uppercase mx-auto hover:text-blue-500 text-xs font-medium text-black">
<a href={`/tags/${tag}`}>{tag}</a>
</li>
))
Expand All @@ -25,23 +30,21 @@ const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())];
class="grid grid-cols-1 mt-12 gap-1 gap-y-24 lg:grid-cols-3 sm:grid-cols-2"
>
{
allPosts
.slice()
.map((post) => (
<EntriesOne
url={"/posts/" + post.slug}
title={post.data.title}
description={post.data.description}
alt={post.data.title}
pubDate={post.data.pubDate.toString().slice(0, 10)}
author={post.data.author}
image={post.data.image.url}
tags={post.data.tags}
/>
))
sortedPosts.map((post) => (
<EntriesOne
url={"/posts/" + post.slug}
title={post.data.title}
description={post.data.description}
alt={post.data.title}
pubDate={post.data.pubDate.toString().slice(0, 10)}
author={post.data.author}
image={post.data.image.url}
tags={post.data.tags}
/>
))
}
</ul>
</div>
</section>
<Cta/>
<Cta />
</BaseLayout>
31 changes: 15 additions & 16 deletions src/pages/tags/[tag].astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
import BaseLayout from "@/layouts/BaseLayout.astro";
import EntriesOne from "@/components/entries/EntriesOne.astro";
import { getCollection } from "astro:content";
export async function getStaticPaths() {
const allPosts = await getCollection("posts");
const uniqueTags = [
...new Set(allPosts.map((post) => post.data.tags).flat()),
];
return uniqueTags.map((tag) => {
// Filter posts by tag
const filteredPosts = allPosts.filter((post) =>
post.data.tags.includes(tag)
);
// Sort filtered posts by date in descending order
const sortedPosts = filteredPosts.sort(
(a, b) => new Date(b.data.pubDate) - new Date(a.data.pubDate)
);
return {
params: { tag },
props: { posts: filteredPosts },
props: { posts: sortedPosts },
};
});
}
Expand All @@ -24,22 +31,14 @@ const { posts } = Astro.props;
---

<BaseLayout pageTitle={tag}>
<section >
<div class="px-8 py-12 md:px-12 mx-auto lg:pb-24 max-w-7xl lg:px-32 lg:pt-48">
<div class="grid grid-cols-1 lg:grid-cols-2 items-center">
<h1 class="text-4xl tracking-tight font-medium font-display text-black md:text-6xl">
{tag}
</h1>
<a
href="/tags"
class="py-1.5 px-4 border focus:ring-2 h-8 rounded-full border-transparent bg-black hover:bg-black/10 text-white duration-200 focus:ring-offset-2 focus:ring-white hover:text-black inline-flex items-center justify-center ring-1 ring-transparent lg:ml-auto"
>
All tags
</a>
</div>

<section>
<div
class="px-8 py-12 md:px-12 mx-auto lg:pb-24 max-w-7xl lg:px-32 lg:pt-48"
>
<!-- Content omitted for brevity -->
<ul
class="grid grid-cols-1 mt-12 gap-1 gap-y-24 lg:grid-cols-3 sm:grid-cols-2">
class="grid grid-cols-1 mt-12 gap-1 gap-y-24 lg:grid-cols-3 sm:grid-cols-2"
>
{
posts.map((post) => (
<EntriesOne
Expand Down

0 comments on commit 44ea055

Please sign in to comment.