Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

Post layout isn't working #205

Closed
PaulTuraew opened this issue Dec 2, 2014 · 6 comments
Closed

Post layout isn't working #205

PaulTuraew opened this issue Dec 2, 2014 · 6 comments

Comments

@PaulTuraew
Copy link

I followed all the directions on creating a .md post (e.g. 2011-12-31-new-years-eve-is-awesome.md), putting it in the _posts folder and included the YAML front matter and it still won't recognize the layout. I am currently running it on my local server.

When I look in my "site" folder and actually see the HTML code for the post, Jekyll is putting the front matter in the content

elements.

Any suggestions? Thank you!

@budparr
Copy link
Contributor

budparr commented Dec 2, 2014

Can you post a link to your repo?

@PaulTuraew
Copy link
Author

Hi Bud,

https://github.com/PaulTuraew/turaew_io_jekyll_blog

Thanks in advance for the help!

@budparr
Copy link
Contributor

budparr commented Dec 2, 2014

Hi Paul,
So, a couple of things. You have empty lines at the top of your .md file, so Jekyll is not properly interpreting your front matter.

Also, have a look at your layout files. Your post layout doesn't have everything it needs to render a page, yet isn't referencing a default layout that has that either. You are calling a CSS file at the top of the page that isn't doing anything because it's not in the . And it looks like you're using your header.html include the way you should be using a default template (because you have your closing body tags in their too).

Here are some examples from the templates that Jekyll installs for you when you make a new instance:

This is the default layout that has a lot of the HTML for your page, but importantly a {{ content }} tag that allows other templates to inherit this template.

<!DOCTYPE html>
<html>
  {% include head.html %}
  <body>
    <div class="page-content">
        {{ content }}
    </div>
    {% include footer.html %}
  </body>
</html>

And this is a post template. Everything in this template gets inserted by Jekyll into the {{content}} tag in the default template. Note that at the top of this template, it references the default templatelayout: default

---
layout: default
---
<div class="post">
  <header class="post-header">
    <h1 class="post-title">{{ page.title }}</h1>
  </header>
  <article class="post-content">
    {{ content }}
  </article>
</div>

I'd suggest doing a fresh install of Jekyll, separate from your current site and having a look at the templates they use there. Hope that helps!

@PaulTuraew
Copy link
Author

Hi Bud,

Thanks for the info, I looked into it, compared the templates and got the post layout to function correctly. Thank you again!

Paul

@budparr
Copy link
Contributor

budparr commented Dec 3, 2014

Glad to hear that!

On Wed, Dec 3, 2014, 11:28 AM Paul notifications@github.com wrote:

Hi Bud,

Thanks for the info, I looked into it, compared the templates and got the
post layout to function correctly. Thank you again!

Paul

Reply to this email directly or view it on GitHub
#205 (comment).

@ghost
Copy link

ghost commented Nov 13, 2017

I had a similar problem, but found out the layout defined in YAML front matter had a wrong spelling!

@jekyll jekyll locked and limited conversation to collaborators Nov 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants