This is a pretty hacky solution, but since dynamic routing and custom URL structures are on the roadmap for Ghost, I just wanted a quick and dirty solution to getting my old WordPress links to work in my new Ghost blog.
The permalink options for WordPress allow you to choose from multiple pre-defined options or to make up your own. My posts used the
I don't particularly care whether the links reflect the actual date of posting, so long as any links appearing in search results, old tweets, or other sites, still work. If I posted
/some-post/ on 5/2/2012, I don't care if the URL
/2001/1/1/some-post/ works, so long as
/2012/5/2/some-post/ works, since that's the link that appears in those other locations.
To set up routes for this strcture, I modified
/ghost/core/server.js. Under the route configuration, I add routes in a loo for all year/month/date combinations for a large number of years. This covers any URLs that might have been made and posted during that time. I also added support for the
/%year%/ formats, in case anyone was interested.
So now, when someone Gooogles "macbook pro trackpad windows 8" and gets my post as a result, it still sends them to http://xdumaine.com/2012/09/01/windows-8-macbook-pro-trackpad/ and the date in the permalink doesn't really matter.
I also added one extra hard-coded route, because I had some "pages" in wordpress that weren't posts, and the permalink was structured as
/projects/page-name. So addding the below route allowed those to work (so if someone searched for "redmine responsive theme, and got a link to http://xdumaine.com/projects/redmine-responsive-design, it would still work).
Note that all of these require that the slugs be identical, as there's no redirection or anything going on. It's simply routing date-esque routes to
frontend.single or the controller for a single post. This also doesn't allow you to specify the permalink structure in the url editor withing the post. All you can edit is the slug.
That's pretty much all there is to it. Make sure to restart Ghost after editing
server.js. Again, this is a really hacky way to do this, and Ghost will likely implement a much more robust solution for dynamic routing and custom permalink structure, but for now, this was a simple way to make sure my SEO and twitter links weren't broken.