Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll - split content up into two columns

I have a basic layout page template:

---
layout: default
---

<header class="sidebar">
    {{ page.title }}
</header>

<section class="content">
    {{ content }}
</section>

My pages that use this as the page template are just Markdown that gets put into the <section> block.

I'm looking for a way to keep all my page content in one file but have it so I can define separate content that gets put into the <header> tag from the page template.

Is there any way to do this and keep all the page's content in one file?

like image 378
Brandon Avatar asked Dec 21 '22 20:12

Brandon


1 Answers

You can do so by defining the content you wish to be separate and reused in the _includes/ directory.

You would then include it by calling for example: {% include file.ext %} to include the of the file name _includes/file.ext (almost as if you just copy and pasted it in).

See section pertaining to the _includes in the Jekyll documentation here.

like image 141
rudolph9 Avatar answered Jan 31 '23 05:01

rudolph9