16

I know how to create a post in jekyll, but how can I create a page (like About) without it being considered as a post?

Also, I use Github pages, so I can't use extensions.

Robert Audi
  • 8,019
  • 9
  • 45
  • 67

2 Answers2

29

If you create a file called about.html, about.markdown or about.textile in the root of your project it will be treated as a static page.

You can still give it some YAML front matter and jekyll if you wish to share a template etc.

It's all explained on the jekyll wiki at https://github.com/mojombo/jekyll/wiki/usage

Here's an excerpt from my about.markdown file

---
layout: default
title: About | Purebreeze
---

I'm a software developer based in London...

That's saying use the default template, set title to "About | Purebreeze" (which is rendered via a liquid tag in my default template) and then the contents of my about page.

This is then rendered at http://purebreeze.com/about by github (by default this would have been (http://levent.github.com/about)

lebreeze
  • 5,094
  • 26
  • 34
  • 1
    Thanks, that works if I go to localhost::4000/about.html but jekyll doesn't seem to create the about folder so that I get the pretty url format (localhost:4000/about/). I tried to add `permalink: /:title` but that didn't do it either... – Robert Audi Mar 18 '11 at 09:13
  • 1
    Have you pushed to github? I find that locally I have to visit about.html but on github it works as /about – lebreeze Mar 18 '11 at 09:25
  • 3
    @Aziz Light @lebreeze: have you added `permalink: pretty` to your `_config.yml` file and rebooting jekyll? I believe Github Pages does this "by default". – kikito Mar 30 '11 at 14:10
  • I use `permalink: /:year/:month/:title` – lebreeze Mar 30 '11 at 15:04
  • 4
    In `about.html` (or whatever file you use for `about`) you should set the permalink to something like `/about/index.html` (in the YAML front matter). – mipadi Apr 20 '11 at 16:53
  • Another cool thing you can do is when linking to the page, use an in-document anchor (`#elementid`) which could link to a specific part of the page (a post in an archive, for example). – Ben Feb 26 '14 at 04:55
  • http://stackoverflow.com/questions/29579545/jekyll-not-displaying-layout-for-static-page having an issue w/ this – quantumpotato Apr 11 '15 at 15:26
1

This looks like a bug. But there's a workaround: create a directory called eg. "about" and put your content into about/index.[fill in the blank]. (oh, and by the way, report it.)

Chris Warrick
  • 1,571
  • 1
  • 16
  • 27