#Markdown glob

2 messages · Page 1 of 1 (latest)

white falcon
#

I'm using astro glob method to get all the markdown files. Than running them through a function to sort them and than map the result array to give me a Post Card. I want to add one more function in the sorting function( I think) that will will look through the frontmatter date and find the one which is closest to the current date. After getting that value I dont know what to do. Can I push new key value pairs? I'm stuck at this one. Because of this I can't find a proper place to use the function.

humble junco
#

here an example of glob, I did use import.meta.glob, which allows better flexibility, basically I can decide what to actually import and what not afterwards by running the await call.
https://github.com/MicroWebStacks/astro-big-doc/blob/09391234d1ab1a72930f9059448a6d72520191b1/src/pages/blog/[...page].astro#L31
the posts is a list, you can filter the way you want to select a post then do the import like in this line https://github.com/MicroWebStacks/astro-big-doc/blob/09391234d1ab1a72930f9059448a6d72520191b1/src/pages/blog/[...page].astro#L40