4

I'm building a Jekyll site made of static pages (e.g. nothing in the _posts directory), and rather than keeping each page in the root directory, I'd like to keep it in a custom pages directory (for organization's sake).

However, I don't want this structure reflected in my URLs, so in my _config.yml I have:

permalink: /:title

With this configuration, my desired URL would be site.com/pagename, but I don't get a rendered page unless I hit site.com/pages/pagename.html.

Could anyone help me configure my build to achieve the former? Thanks!

Jon
  • 1,337
  • 1
  • 14
  • 32

2 Answers2

1

Have you tried adding YAML Front Matter to these static pages? For example:

---
title: "pagetitle"
---

This way, Jekyll should recognize it as a Page (instead of a StaticPage) and would use your permalink configuration.

Carlos Agarie
  • 3,952
  • 1
  • 26
  • 38
0

These are static pages so the entry in _config.yml is going to be ignored.

From the sounds of it you will need to create a URL rewrite rule. How to do this will depend on the web server that is servering up the pages.

RobertKenny
  • 3,556
  • 2
  • 19
  • 17