Migrating to Kirby...Handling Permalinks

Hey all,

I’m new here, happy to join the community. :smile:

Looks like I’m finally ready to make the leap to Kirby for my blog, but as I plan for the migration (and wrap my head around building a new site from scratch for Kirby), I find myself encountering a potentially serious structural issue.

The docs recommend setting up a blog using a separate ‘blog’ folder with individual articles nested within, which produces this permalink structure:


The problem is that my existing blog doesn’t have this hierarchy…the two pages (About and Contact) are hierarchically equivalent to all the blog articles, so my permalinks are simply:


Since I want the site to have the same general appearance (a list of articles as the homepage) I see two possible solutions and want some feedback on which is smarter and how to go about implementing the better option:

  1. Keep the structure: in this case, wouldn’t all of my pages show up in the list of articles on the homepage? Or since they’d all use an “article.php” template I assume I can somehow use PHP to omit the “about/contact/otherpage.php” items from being listed, right? And how do I handle the menu and making sure it doesn’t try to add all my articles as nav items? I assume hard-coding the nav instead of using dynamic links is the easiest way around that.
  2. Change the structure: if I decide to adopt the ‘/blog/article’ permalink structure, what’s the nicest way to handle the migration so the existing links are cleanly resolved? 301s via the .htaccess file? If I redirect all ‘site.com/article’ traffic to ‘site.com/blog/article’, it would also break the old page permalinks, so how would I go about it? I’m mostly an Nginx guy so I’m not super familiar with Apache and its ways.

Thanks for any feedback you can offer—I’m super excited to be working with Kirby after years of having it recommended.

Well, first of all, there is no reason why you should need a separate folder for the blog, you might just as well put the articles as subfolders of the home folder if that where they will appear anyway; if you want, you can also just rename the home folder to blog and set that as your home folder in your config.php (c::set('home', 'blog').

Another option would be to uses routes to omit the blog folder from the url http://getkirby.com/docs/advanced/routing.

1 Like

I hadn’t discovered routing yet—that’s a fantastic solution.

Not sure what renaming the home folder achieves though…could you explain what that would change?

Nothing really … it’s just an option.