DEV Community

loading...

Discussion on: Building a blog with Svelte: Adding Markdown

Collapse
jreinhold profile image
Jeppe Reinhold

This is great!
I guess a missing (next) step here, is to render pages/build components based on multiple markdown files in a folder?

Collapse
chrsjxn profile image
Chris Jackson Author

Mine are currently very simple, and very manual. The page component for this post just looks like this:

<script>
  import { Layout, MarkdownPost } from '../Components'
  import markdown from '../Markdown/AddingMarkdownToSvelte.md'
</script>

<Layout>
  <MarkdownPost {markdown} />
</Layout>
Enter fullscreen mode Exit fullscreen mode

I am still thinking about a build step that generates these components and their routes based on the structure of my markdown directory. My level of rollup knowledge isn't that high yet, though, so I'm just writing the extra glue by hand right now.