File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ import {
5959 <li ><a href =" /" >About</a ></li >
6060 <li ><a href =" /projects" >Projects</a ></li >
6161 <li ><a href =" /notes" >Notes</a ></li >
62+ <li ><a href =" /writings" >Writings</a ></li >
6263 </ul >
6364 </nav >
6465 <template id ={ modeTemplateId } >
Original file line number Diff line number Diff line change @@ -11,5 +11,16 @@ export const collections = {
1111 } )
1212 . required ( )
1313 . strict ( )
14+ } ) ,
15+ writings : defineCollection ( {
16+ type : "content" ,
17+ schema : z
18+ . object ( {
19+ title : z . string ( ) ,
20+ dateCreated : z . date ( ) ,
21+ dateUpdated : z . date ( )
22+ } )
23+ . required ( )
24+ . strict ( )
1425 } )
1526} ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ const { Content } = await note.render();
2020const { title, dateCreated, dateUpdated } = note .data ;
2121---
2222
23- <Page title = { title } >
23+ <Page {title }>
2424 <Article >
2525 <h1 class =" smaller-spacing" >{ title } </h1 >
2626 <CreatedUpdatedTime
Original file line number Diff line number Diff line change 1+ ---
2+ import { getCollection } from " astro:content" ;
3+
4+ import PostItem from " @components/post-item.astro" ;
5+ import Page from " @layout/page.astro" ;
6+
7+ const writings = await getCollection (" writings" );
8+ ---
9+
10+ <Page title =" Writings" >
11+ <h1 class =" smaller-spacing" >Writings</h1 >
12+ <p class =" larger-spacing" >
13+ Longer form writings, essays, or ramblings that you might be interested in
14+ </p >
15+ <ul >
16+ {
17+ writings
18+ .sort (
19+ (a , b ) => b .data .dateCreated .getTime () - a .data .dateCreated .getTime ()
20+ )
21+ .map (({ slug , data : { title , dateCreated , dateUpdated } }) => (
22+ <PostItem
23+ { title }
24+ { dateCreated }
25+ { dateUpdated }
26+ link = { ` /writings/${slug } ` }
27+ />
28+ ))
29+ }
30+ </ul >
31+ </Page >
Original file line number Diff line number Diff line change 1+ ---
2+ import type { CollectionEntry } from " astro:content" ;
3+
4+ import { getCollection } from " astro:content" ;
5+
6+ import CreatedUpdatedTime from " @components/created-updated-time.astro" ;
7+ import Article from " @layout/article.astro" ;
8+ import Page from " @layout/page.astro" ;
9+
10+ export async function getStaticPaths() {
11+ return (await getCollection (" writings" )).map ((writing ) => ({
12+ params: { slug: writing .slug },
13+ props: { writing }
14+ }));
15+ }
16+
17+ type Props = { writing: CollectionEntry <" writings" > };
18+ const { writing } = Astro .props ;
19+ const { Content } = await writing .render ();
20+ const { title, dateCreated, dateUpdated } = writing .data ;
21+ ---
22+
23+ <Page {title }>
24+ <Article >
25+ <h1 class =" smaller-spacing" >{ title } </h1 >
26+ <CreatedUpdatedTime
27+ class =" small-text larger-spacing"
28+ created ={ dateCreated }
29+ updated ={ dateUpdated }
30+ />
31+ <Content />
32+ </Article >
33+ </Page >
Original file line number Diff line number Diff line change @@ -28,8 +28,9 @@ $initialLogoMenuWidth: v-size(14);
2828 margin-left : v-size (4 );
2929 }
3030
31- // NOTE: Change to 'm-large' when more nav items are added
32- @include m-small {
31+ // NOTE: The included media query may need to be updated when the number of
32+ // nav items is updated.
33+ @include m-large {
3334 .header {
3435 grid-template-columns : 1fr 2fr ;
3536 justify-items : end ;
@@ -98,7 +99,8 @@ $initialLogoMenuWidth: v-size(14);
9899 }
99100 }
100101
101- // NOTE: Change to 'm-large' when more nav items are added
102+ // NOTE: The included media query may need to be updated when the number of
103+ // nav items is updated.
102104 @include m-medium {
103105 .header {
104106 grid-template-columns : 1fr 2fr 1fr ;
You can’t perform that action at this time.
0 commit comments