I have a jekyll site with filestructure like so:
▾ _includes/
post-entry.html
▾ _posts/
2012-11-25-first-post.markdown
index.markdown
In my index.markdown, I want to include a post-entry.html
like this:
{% for post in site.posts %}
* {% include post-entry.html %}
{% endfor %}
But this appears as a HTML code snippet in the blog. How can i prevent the HTML from being protected?
Span-level HTML tags — e.g. <span> , <cite> , or <del> — can be used anywhere in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you'd prefer to use HTML <a> or <img> tags instead of Markdown's link or image syntax, go right ahead.
Your Jekyll pages consist of HTML, CSS, and JavaScript, so pretty much any code you need to embed will work without a problem.
You can add html inside markdown files in /content. However your indented code will follow markdown formatting. You could also save your content files as . html but then you'll have to write everything in html.
You can use liquid tags in any markdown file so long as it has YAML header matter. For instance, check out the index.md given in the jekyllbootstrap template for Jekyll sites.
If you link to your actual index.markdown or your repository itself (e.g. if it's on github), we could probably get a better idea of what has gone wrong. Your example should work, though you might need to use HTML list element <li>
rather than the markdown *
.
The problem is the parser views the HTML as code blocks. The best way would be to turn off code blocks like I asked in this question
To work around use the replace tag:
{% capture includeGuts %}
{% include post-entry.html %}
{% endcapture %}
{{ includeGuts | replace: ' ', ''}}
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