As you should know, Grav is a flat file system CMS. This means the application does not require a database to work.

When you need to add a new blog post, you just need to create a folder and add a new file inside it. When you have your file, you can open it and add it your contents. Nice and easy!

The blog post you just created, uses as its page url, the folder name. Hopefully that name is quite long, briefs the post content and contains some useful seo keywords.

A real world example would look like this one:

blog
    add-the-posts-categories-to-our-blog-navigation-menu-powered-by-grav-cms
        item.md
        img.jpg
    blog-posts-schedulation-with-grav-cms
        item.md
        img.jpg
    efficient-way-to-properly-name-blog-posts-folders-for-a-grav-cms-blog
        item.md
        img.jpg
    how-to-configure-a-grav-cms-plugin-overriding-its-configuration
        item.md
        img.jpg

This works very well until you have few entries, but, while your blog grows, it would be always more difficult to find a particular post, or just the last one you have started to written yesterday. This happens because post folders are not ordered by date but by name.

To start giving a better organization to your blog posts, you could add some non-written rules to yourself, to keep thinks organized:

  • The url is defined into the page itself, using the slug property.
  • The folder name is made by two tokens: the first is the publishing date of your post, the second is a brief description, just to have a quick recall about the post topic.
  • The date token is represented by six digits and the format is strictly represented by the YYMMDD rule. This means two digits for the year, two for the month, two for the day.

In this way posts are well ordered in your folder by date and, thanks to the brief description, you are able to immediately recognize the topic of your post.

After applying those rules, the previous example will result as follows:

blog
    150801-grav-navigate-through-categories
        item.md
            slug: add-the-posts-categories-to-our-blog-navigation-menu-powered-by-grav-cms
        img.jpg
    150802-grav-posts-schedulation
        item.md
            slug: blog-posts-schedulation-with-grav-cms
        img.jpg
    150803-plugin-configuration
        item.md
            slug: how-to-configure-a-grav-cms-plugin-overriding-its-configuration
        img.jpg
    150804-blog-folders-name
        item.md
            slug: efficient-way-to-properly-name-blog-posts-folders-for-a-grav-cms-blog
        img.jpg

Obviously those rules are not written in the stone, so you can customize them as you prefer. You may want to have an eight digits date and keep the full slug in the title. In this case, the blog folder will look as follows:

blog
    20150801-add-the-posts-categories-to-our-blog-navigation-menu-powered-by-grav-cms
        item.md
            slug: add-the-posts-categories-to-our-blog-navigation-menu-powered-by-grav-cms
        img.jpg
    20150802-blog-posts-schedulation-with-grav-cms
        item.md
            slug: blog-posts-schedulation-with-grav-cms
        img.jpg
    20150803-efficient-way-to-properly-name-blog-posts-folders-for-a-grav-cms-blog
        item.md
            slug: efficient-way-to-properly-name-blog-posts-folders-for-a-grav-cms-blog
        img.jpg
    20150804-how-to-configure-a-grav-cms-plugin-overriding-its-configuration
        item.md
            slug: how-to-configure-a-grav-cms-plugin-overriding-its-configuration
        img.jpg

What you should really leave unchanged is the format order, which must always be Year, Month, Day and both month and day must be represented by two digits. All the other situations would produce a bad ordering result.

Next Post Previous Post

Related Posts