Page organisation

I would like to organise my pages into a Pages directory. I’ve tried this, so I have an About page in /Pages, but I can only access it at local:4567/pages/about.

Is there a way to do this type of page organisation and make the url local:4567/about?

If it’s just a few pages, you can add this to your config.rb

redirect "/my/old/path.html", to: "/my/new/path.html"

If it’s more pages than you care to redirect one at a time like this, it’s trickier. There is obviously is a way, since the blog extension does it, but I have not been able to figure it out.

Two workarounds (neither is especially elegant), but at least the first one is a quick way to get the job done:

  • Use after_build to move every rendered file in the pages directory up one level. Search and adjust all relative links.

  • Use Rack Redirect.

It looks like it could be more trouble than it’s worth, then. Thanks very much for your help.

I just realized I’m using a workaround on one of my sites, that works really well.

The site is not a blog, but I still use the blog extension to publish the pages. This makes it possible to do this (names adjusted to fit your example):

activate :blog do |blog|        
  blog.name = "Whatever"  # I think this needs to be here, but you do not need to use it
  blog.sources = "pages/:title.html"
  blog.permalink = ":title.html"
  

Thanks very much for that, I’ll give it a go.