I have a very simple use case for metalsmith that doesn't seem to be covered by any readily available documentation.
In my index.html I want multiple content areas:
<!-- in my index html -- a single page landing site -->
<body>
<section id="about">
{{{about}}}
</section>
<section id="faq">
{{{faq}}}
</section>
...
And I want the contents for about and faq to come from markdown files. I'm happy to change how my files are organised/marked up.
I just can't figure out which plugins to use to make it work, everything seems geared towards generating one output file per source file.
The plugins that seem they would work (metalsmith-in-place and metalsmith-layouts) tell you to come to SO for more elaborate examples, so here we are!
I created a fork for metalsmith-markdown:
https://github.com/DKhalil/metalsmith-markdown
You can add sections in your markdown files like this:
Markdown text here
---
section: SECTION_NAME
---
Markdown text here
The second markdown part would be available under the variable SECTION_NAME in the template file, the first one still under {{ contents }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With