Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Creating a blog with Grav

Solved by pamtbaau View solution

Started by Sergi 2 years ago · 5 replies · 940 views
2 years ago

Hi,

I'm creating a website with Grav using the skeleton blog based on the Quark theme, with about 200 blog entries, and often duplicate folder names appear. It's easy to avoid that problem manually by removing or adding characters, but.... Is there any method or plugin that helps to create a unique ID automatically and cleanly in the eyes of an end client?

I also see some unwanted side effects that make me question if this is the best way to create a blog with Grav, although all the themes I've downloaded use the same strategy... For example: in the advanced options tab (Admin plugin) the long menu list moves the below options a long way away :D

Has anyone used any other way to create a blog? Flex-objects could be a good candidate here? According to the official documentation, it doesn't support multilanguage (a must for my projects) and I don't see how to manage images and related files, or how it would integrate with other plugins like sitemap, etc.

Thanks for your help!

👍 1
2 years ago

@sdesergi:
I’m creating a website with Grav using the skeleton blog based on the Quark theme, with about 200 blog entries, and often duplicate folder names appear.

Since you already know the number of blog items, I guess you are converting an existing site? And the existing site is presumably not file based?

and often duplicate folder names appear.

How come blog items have the same folder name?

Is there any method or plugin that helps to create a unique ID automatically and cleanly in the eyes of an end client?

I don't think so.

I also see some unwanted side effects [...] For example: in the advanced options tab (Admin plugin) the long menu list moves the below options a long way away 😃

In general, libraries don't put all books on a single shelve... Have you considered creating multiple subfolders (or even root folders) based on topic (category/tag), or year, or any other commonalities?

2 years ago

Thank you @pamtbaau for addressing the question with Grav CMS

Right, I'm converting an existing site. I can't use the same links due to bad practices, it's something I need to correct. Anyway, I wasn't just thinking about existing posts, but rather future posts. No problem.

I hadn't thought about it until your reply refloated this thread. I didn't know that different subfolders could be printed from the same parent folder. Grav surprised me again :)

Having consulted the documentation, I think I have to use the following collection

YAML
content:
    items:
      '@page.descendants': '/blog'

Or with multiple collections for display only the posts, or using this other collection to display categories:

TXT
 '@page.children': '/blog'

I look forward to testing. Thanks again!

last edited 03/12/24 by Sergi
2 years ago Solution

@sdesergi, When the collection is defined inside /pages/01.blog/blog.md you can simply use:

YAML
content:
    items: '@self.descendants'

See [email protected]

2 years ago

Yes, thanks!

The problem with descendants is that it shows both child and grandchild folders, mixing categories with entries at the same level. But Grav has plenty of solutions :)

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 53 9 hours ago
Support · by Anna, 3 days ago
2 59 12 hours ago
Support · by Justin Young, 13 hours ago
1 30 13 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 56 5 days ago