Jieiku / abridge

Fast & Lightweight Zola Theme
https://abridge.pages.dev/
MIT License
147 stars 41 forks source link

Posts organization #97

Closed realtica closed 1 year ago

realtica commented 1 year ago

Hello, is it posible to organize posts like this?:

/content/posts/2022/11/my_post/index.md

URL: http://example.com/my-post

Jieiku commented 1 year ago

Good Question, would be a nice way to organize them, would need to read the zola docs, I will see if I can figure it out once I am no longer sick with a cold.

Jieiku commented 1 year ago

This does not appear to be possible, if you do happen to find a way then feel free to post here and I will reopen this.

What you can do is name your files like so: 2020-07-25-my-post.md

2023-02-05_17-59-47

Then in the markdown just set the title AND the slug:

+++
title = "My Post"
slug = "my-post"
+++
cskwrd commented 1 year ago

@realtica I haven't found a set and forget way of getting the URLs to be built as you've described, but if you set path = "my-post" in the frontmatter for /content/posts/2022/11/my_post/index.md you will see the desired result.

You have to do this for any and all posts where the date should be removed.

Setting the path in the post frontmatter really isn't enough, however. You will likely want to place an _index.md with the following frontmatter in each section (up to the section you want the posts to appear as belonging to):

+++
transparent = true
+++

For each section you add this frontmatter to, it will roll up all children to the parent section.

These intermediate sections will still render however. If you wish to prevent that, add render = false to the frontmatter above. After doing that, navigating to the now unrendered intermediate section will result in a 404.

If the 404 in that case is undesirable, add redirect_to = "some/path" to the intermediate frontmatter, and your browser will be redirected to the specified path when navigating to that unrendered intermediate section.

Jieiku commented 1 year ago

Thanks for taking the time to write that up and share it. I am sure it will help others as well.

To bad there is not a simpler way of doing it, as you said "set and forget".

Still this is very good info!