efficient way of parsing markdown files with solidjs and solid-start

I'm recently starting to learn to write a blog from scratch with solidjs and solid-start. After watching many videos, I'm still a bit confused about several concepts here about SSR and file parsing etc: 1. I have a folder that contains many markdown files, with front-matter (title, date, tag, etc.). 2. Like most blog website, I'm planning to have a front page (P1) showing the most 10 recent posts, each is a link that link to a separate page (Pn) with that post. Based on my understanding, I need to: 1. For P1, I need to load all the markdown files (at least their front-matter?), and show them. 2. For Pn I need to render the page. Question: 1. For each Pn, is it loaded twice if I open the page (once on P1, and once for open Pn)? Should I use a server side database, or import.meta.glob is enough? 2. Is solid-start's mdx render enough for the separate page, or I need to write my own components since the markdown have front-matter? 3. recommended packages? (If need for parsing .md file or front-matter)
6 Replies
x_arthurx
x_arthurxOP16mo ago
May be an extra question about SSR: for applications like this, what should happen on the server and what on the client side? I saw some tutorials buiding app routes responding to the client requests, while some are more static site style.
mdynnl
mdynnl16mo ago
1,2,3 i haven't really dug into it but i'd bet solid-start-mdx already solves the frontmatter parsing, which should just be a matter of parsing the frontmatter out and the content to a lazy import
thetarnav
thetarnav16mo ago
if you don’t need mdx, you can look at the solid-primitives site as an example: https://github.com/solidjs-community/solid-primitives/tree/main/site we are creating pages from the package readmes in md
GitHub
solid-primitives/site at main · solidjs-community/solid-primitives
A library of high-quality primitives that extend SolidJS reactivity. - solidjs-community/solid-primitives
x_arthurx
x_arthurxOP16mo ago
I tried solid-start-mdx, it can load/render mdx and generate pages from it, but I don't see examples of using the front matter.
x_arthurx
x_arthurxOP16mo ago
Thx, I'll check it. But the question of reading all .md and show it in one page is still in question?
Want results from more Discord servers?
Add your server