Question: With Jekyll is it possible to display part of a markdown file in a template file?
I would want to do this in order to avoid using div
's in my markdown, I have some elements that need styling and if you put div
's in markdown then anything in them will not be marked down(if you add markdown="1" it just adds a grey box around the text). So to get around this I want to capture some text like so:
{% capture workshops %}
![Suitcase]({{ site.url }}/img/icons/suitcase.png)
**Proffesional Workshops**
Brief description of workshops, more detailed description
of workshops will go on seperate dedicated page.
{% endcapture %}
and then somehow put this markdown in the layout page maybe like this?
<div class="feature">
{{ page.workshops }}
</div>
Is this possible? or is there a better way of getting around using div
's
You could use excerpts.
Quote from the link:
I'm not sure if you need this for blog posts or for actual pages.
The above quote is from the documentation about blog posts, but apparently every page has the
.excerpt
property, according to the documentation about variables.(I didn't try it with a page, though)