In Jekyll, I am trying to include a paragraph of "site information" that should go on a certain amount of pages in my website. The file structure of the certain information I am dealing with is a "team"folder->"_posts"folder-> then within the "_posts" folder is "site_information.md" and many other markdown files of pages that I want to include the "site_information.md" in. I do not want to use an includes statement on every single file in "_posts" folder if possible, so I want to make an includes statement in the "layout.html" file.
Here is what I have tried in the "layout.html" file:
{% if page.page == "page" %}
{% include_relative site_information.md %}
{{content}}
{% endif %}}
The code above included the information I wanted, but it did not include it in markdown format.
I then tried this:
{% if page.page == "page" %}
{% capture site_info %}{% include_relative site_information.md %}{% endcapture %}
{{site_info}}
{{content}}
{% endif %}
This code does not display the "site_information.md" information on the pages at all when using the capture tag.
I then tried this:
{% if page.page == "page" %}
{% capture site_info %}{% include_relative site_information.md %}{% endcapture %}
{{site_info | markdownify}}
{{content}}
{% endif %}
This code gave me the error when using the markdownify tag:
Liquid Exception: undefined method `gsub' for nil:NilClass in _layouts/layout.html
Does anyone know how to fix this so I can use an includes statement in the layout to properly display a markdownified file on a number of web pages?
{% if page.page == "page" %}
? – David Jacquelindex.html
and topost/123456-mypost.md
. Why not aninclude
with the same test ? – David Jacquel