Migrating from WordPress, need to preserve category-specific URLs

I maintain a multiauthor blog with WordPress. The site has several blog categories, a general blog page that displays all posts, and a few special pages (such as “About”). Posts use this URL format: site.org/category/post-title.

Is there a way to migrate to Grav and preserve the following?

  • author information
  • post categories
  • general blog page that displays all posts (from all categories)
  • URLs that show category (category/post-title)

I’m trying to migrate this site: Plisi.org. I would’ve switched to Grav long ago, but keeping the URLs intact and having a general blog page is extremely important. Thank you very much.

There’s no magic button. It’s absolutely possible, but you’ll need to get your hands dirty.

To start, here’s what the docs say: https://learn.getgrav.org/migration/wordpress.

Here’s the link to the export tool: https://github.com/SiteBeez/wordpress-wp2grav-markdown-exporter.

I still needed to munge the markdown to make it work just the way I wanted, but if you have a good text editor that supports regular expressions, it should be relatively straightforward.

And of course you still need to configure your themes and site config. But this will at least preserve your content.

Thank you very much. I got the WP2Grav plugin. I’m still trying to figure out how to maintain category-specific URLs.

1. One way might be to get the blog home page to display posts from category folders. My “pages” folder currently contains subfolders for each category. It looks something like this:

  • pages/category1/post-title-1
  • pages/category1/post-title-2
  • pages/category2/post-title-1
  • pages/category2/post-title-2

I got Grav to show a link to the category folder, but I can’t get it to show the actual posts right away.

2. Another way might be to update slugs to <category/post-title>, and keep all posts in the “pages” folder. Not an ideal solution, but something to consider.

3. The Knowledge Base theme does something similar to what I want. Post titles grouped by category appear on the home page. But I’d prefer a blog layout with post titles and a post preview.

Thank you again!

While I don’t use child folders personally, my understanding is that it works fine to have a structure as you describe. You could create index pages at each level using page collections.

The only “problem” with your approach is that it assumes a one-to-one relationship between a category and an article (or that you’re symlinking articles in multiple categories). You can combine Grav’s taxonomy system with page collections to keep your articles in a single folder but still create category-specific indexes. See my Knowledge Base theme for an example.

Thank you very much. I believe updating the page collection to show “@root.descendants” will do the trick.

P.S. It did work. And thank you so much for the Knowledge Base theme. I might still consider using it (with some tweaks) because it’s awesome. I’m not a professional, so you’ve really helped me with this project.

I’m glad you found it useful. Hack away.