Parsing and displaying Wordpress blog entries

I’m valiantly exploring the notion of translating an existing Wordpress site into a Grav site. Speed and security and memory usage are my main drivers (in that order).

The existing site has about 800 or so blog posts. They have all kinds of tags and also each post has one or more CATEGORIES. (and there will be more once this thing is stabilized – approximately a blog post every three or four days)

I use the categories as display controls.

So, for example: a blog post that has the categories “News,” Bananas," and “Plums,” will appear on three pages: the News page (along with all the other blog posts with the “News” category), the Bananas page, and the Plum page.

This system evolved over time – I used to keep a separate blog for each and every project and once we hit, like, a dozen projects, that became ridiculous. This method allows me to write a post, and then specify through the choice of category (-ies) where I want that blog post to show up. (I have no “all blog posts” page – all posts are supposed to refer to a project)

In Grav, it SEEMS like if I want to do the same thing, I would set up a page of type BLOG, and then presumably translate all these WordPress posts as pages of type ITEM into that page.

But then…

…I get a little confused.

Is there a way on (same examples) the Banana Grav page (which would contain information about project Banana) to add a shortcode or some other callout that basically says "also, add here a list of all the blog posts that are of category “Banana”?


First of all, you want to export the WordPress-posts into a format usable by Grav, not actually parse them using Grav as that is hugely inefficient.

Second, Grav’s taxonomy-system is abstract enough to allow the setup you describe. Any post can belong to several categories, be tagged however you want, or be organised with as loose connections as you desire.

What you are describing only require that each post defines its taxonomical belonging in FrontMatter, and then the theme delegates appropriate pages based on taxonomy. For example one containing all “Banana”-pages with specific content related to this category.

I would give a better example, but I’m on my phone.

And this is a thing that would let me keep all my blog entries in one folder, but allow certain entries to be listed on a wholly different page?

So, in pseudocode:

On page specializing in bananas, write some stuff about bananas, and then at the bottom of the page, some sort of shortcode to the effect of:

Here, list-with-pagination all pages of type Item that are children of the other page BlogMasterList, and have as one of their categories “Banana”


Yes, the structure of posts physically (on disk) and virtually (in practice) is not explicit. Posts can be arranged by logic defined in the theme - or more programmatically through a plugin - rather than a hierarchy of folders. Consider the following:

One file per post, named like:, in the folder pages. For each such Markdown-file we have translated taxonomies and other metadata out of WordPress and into the FrontMatter, like so:

title: TITLE
date: YEAR-MM-DD
    category: [banana, strawberry]
    tag: [taste, texture, nutrition]
    author: edwardmartiniii

For more on taxonomy, see the docs. Given this simple decoupling of physical structure from virtual organization, the theme can assign templates, plugins can have shortcodes, and content can be displayed without concern for anything other than the available taxonomies.

For simplicity, we may store all posts in pages/posts/ and create a pages/banana/ to have a specific page for this category. Assign the template through the file - - and write content to fit. The theme will pick up that this is a category-page, and we could infer the specific category from it’s title or just assign taxonomy: category: banana. Given that the theme now knows the context, we can iterate through all sorts of loosely or strictly banana-related content, like pages belonging to this category.

Of course, templates can arbitrarily iterate through any content as long as you explicitly define which content; so any template could find content with the category banana and display it if you so desired.