-
I’m probably missing something, but what’s the most elegant way of setting up a “content page” that embeds a partial, to come out with something like
The only not-too-ugly way I could get to work was to switch to Nunjucks and HTML:
This index.njk is the result, but if there is an elegant way to keep Markdown for the content—and ideally not splitting up the content into two files, either—I’d like to take that approach. Thanks for any pointers! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Wouldn't something like this work? ---
title: Homepage
twitter: pdehaan
email: [email protected]
website: https://twitter.com/pdehaan
---
# Heading Number One
Some paragraph text.
{% include "partials/websites.njk" %}
## Heading Number Two
1. ordered list bullet
1. more list items
> Block quote Then you just need to set Seems to work for me locally (albeit with a very simple test case) and rendered out the following HTML: <h1>Heading Number One</h1>
<p>Some paragraph text.</p>
<ul><li><a href="https://twitter.com/pdehaan">Website</a></li><li><a href="pdehaan">Twitter</a></li><li><a href="mailto:[email protected]">E-Mail</a></li>
</ul>
<h2>Heading Number Two</h2>
<ol>
<li>ordered list bullet</li>
<li>more list items</li>
</ol>
<blockquote>
<p>Block quote</p>
</blockquote> |
Beta Was this translation helpful? Give feedback.
-
Thanks @pdehaan! This was super-strange. When I read your description and then went back to trying it, I recalled the specific problems I had in the beginning, when the partial was not rendered correctly. Now I took a closer look at that problem and noticed how the partial did actually get included—but was for some reason rendered as code ( The respective commit shows the changes. Do you or does anyone know why this indentation would “break” displaying of the partial? Thank you, @pdehaan, for your help! |
Beta Was this translation helpful? Give feedback.
Wouldn't something like this work?
Then you just need to set
markdownTemplateEngine: "njk"
in your .eleventy.js config file (which I see you're already doing; but more of a heads-up for future readers).Seems to work for me locally (albeit with a very simple test case) and rendered out the following HTML: