Closed francisbarton closed 4 years ago
I'm going to try to write the footer as a paired shortcode.
I think if I understood the way in which {{ content | safe }}
worked then I could work out how to do a similar thing with the footer text. But this is currently a mystery to me.
{{ content | safe }}
obviously brings in content from the .md templates such as about/index.md
. How can I get it so I can write something similar like {{ footer | safe }}
within the same layout file (base.njk
) that will convert and include a footer.md snippet? I haven't yet discovered what the content
bit means and where this is defined.
base.njk
needs to be base.md
if you want it to process markdown! Keep in mind the default markdown template engine is Liquid so make sure you change that to Nunjucks if you want to keep using Nunjucks syntax in the file.
See https://www.11ty.dev/docs/config/#default-template-engine-for-markdown-files
This is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.
If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and I will reopen the issue. Thanks!
I have just started using eleventy and am using this base-blog theme. Now trying to customise it. I am trying to do something that I thought would be very simple to do with the Nunjucks templates and Markdown files, but I am not getting it to work, yet.
What I want to do
Use a markdown snippet as the source file for some footer text, and get this converted to HTML and drawn into the page layout as it's rendered.
What I've tried
I have edited
base.njk
so that I have:and then I have a file footer.md that is basically just markdown. I have tried adding front matter to the .md file to get it recognised, but it seems to make no difference.
Here's my current
footer.md
:Originally I tried making the footer text a template in markdown, and calling this in using
{{ content | safe }}
as in the<main>
section, but all this did was reproduce the main content in the footer, not the content of my footer template.From the 11ty docs, it seems to me that there is no reason why this include should not be converted from markdown to HTML
What I get:
When the footer is rendered, it does not convert the Markdown to HTML - I just get raw markdown (the link is not created).
I can't work out what I doing wrong, and would be grateful for any help.