File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import ArrowUpRight from "./ArrowUpRight.astro";
1111 <a class =" py-2 hover:underline" href =" /" > Home </a >
1212 </li >
1313 <li >
14- <a class =" py-2 hover:underline" href =" /blog" > Posts </a >
14+ <a class =" py-2 hover:underline" href =" /blog" > Blog </a >
1515 </li >
1616 <li >
1717 <a
Original file line number Diff line number Diff line change 11---
2+ interface Props {
3+ tags: string [];
4+ }
5+
26const { tags } = Astro .props ;
37---
48
59<div >
6- <h1 class =" my-8 mb-2 tracking-wider text-gray-900 dark:text-gray-100" >
7- Tags
8- </h1 >
9- <ul class =" flex flex-wrap" >
10+ <ul class =" mb-6 flex flex-wrap" >
1011 {
1112 tags .map ((tag : unknown ) => (
12- <li class = " mr-3 text-sm font-medium text-gray-400 hover:underline dark:text-gray-600 " >
13- <a href = { ` /tags/${tag } ` } >{ ` #${ tag } ` } </a >
13+ <li class = " mr-3 text-sm font-medium text-gray-600 hover:underline dark:text-gray-400 " >
14+ <a href = { ` /tags/${tag } ` } >{ tag } </a >
1415 </li >
1516 ))
1617 }
Original file line number Diff line number Diff line change @@ -3,16 +3,20 @@ import { getCollection } from "astro:content";
33import BlogPostCard from " ../../components/BlogPostCard.astro" ;
44import Navbar from " ../../components/Navbar.astro" ;
55import BaseLayout from " ../../layouts/BaseLayout.astro" ;
6+ import Tags from " ../../components/Tags.astro" ;
67
78const posts = await getCollection (" blog" , ({ data }) => data .draft !== true );
89const orderedPosts = posts .sort ((a , b ) => {
910 const aDate = new Date (a .data .pubDate );
1011 const bDate = new Date (b .data .pubDate );
1112 return bDate .valueOf () - aDate .valueOf ();
1213});
14+ const tags = [... new Set (posts .map ((post ) => post .data .tags ).flat ())];
1315---
1416
1517<BaseLayout title =" Milán Herke - Blog" >
1618 <Navbar />
19+ <h1 class =" mb-1 mt-4 lowercase text-gray-900 dark:text-gray-100" >Posts</h1 >
20+ <Tags tags ={ tags } />
1721 { orderedPosts .map ((post ) => <BlogPostCard post = { post } />)}
1822</BaseLayout >
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ const allPosts = await getCollection(
2525
2626<BaseLayout title =" Milán Herke - Blog" >
2727 <Navbar />
28- <h1 class =" my-8 mb-2 tracking-wider text-gray-900 dark:text-gray-100" >
29- Posts with { tag } tag
28+ <h1 class =" mb-6 mt-4 lowercase text-gray-900 dark:text-gray-100" >
29+ Posts tagged with { tag }
3030 </h1 >
3131 { allPosts .map ((post ) => <BlogPostCard post = { post } />)}
3232</BaseLayout >
You can’t perform that action at this time.
0 commit comments