Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll: _includes & layout questions

I'm new to Jekyll and web programming in general. I've been looking around for some answer to the particular questions I have and have found none. If they are out there, they must have names I don't know.

A couple of questions about my new Jekyll site:

I am trying to use the _includes as basically a way of creating the "areas" of the site. I'd like to have an include for the header, footer, navigation, maybe even a sidebar, eventually, so that when I make a change to my site design, I only have to change the files there.

The problem I am having is that, while my {% include name.html %} Liquid is working for index pages (siteurl.com/index.html and etc.) which use _layouts/default.html, I also want to be able to use the includes in my posts which use _layouts/post.html.

Unfortunately, no matter what I try I cannot get the posts to render with my header, nav bar, and footer! The posts are generated with only the post content. I thought the point of using Jekyll was to separate post content from post layout and use Jekyll to stitch them together at the end?

All of the code for my project is online at github.com/illiooo/illioo.github.io and the live site can be viewed at illioo.github.io.

I'm using standard Jekyll directory structure, so my layouts are in _layouts and my includes are in _includes. Thanks for any help!

like image 716
Chase May Avatar asked Apr 15 '26 06:04

Chase May


1 Answers

In your posts you have to write

layout: post

instead of

layout: post.html

Just omit the .html file extension.

like image 57
Matthias Herlitzius Avatar answered Apr 16 '26 18:04

Matthias Herlitzius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!