Jieiku / abridge

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

[Feature Request] Prefix all posts' urls with "posts/" #128

Closed samueloph closed 11 months ago

samueloph commented 12 months ago

Looks like there's no configuration setting that lets me prefix all posts with "posts/", I like this behavior because it makes the urls more descriptive.

Example: Instead of url like "example.com/post-title", to have "example.com/posts/post-title"

Also allowing for the date to be used as a prefix might be useful for other users too, example "example.com/2023/07/16/post-title".

Edit- I could accomplish something similar with https://peterbabic.dev/blog/setting-url-prefix-in-zola/

Jieiku commented 12 months ago

This is related for the date: https://github.com/Jieiku/abridge/issues/97

I never used a url prefix, there might be more than one way to accomplish that.

Jieiku commented 11 months ago

I looked over the link you shared.... I think that solution would work, but you might lose the posts page that shows an overview of all posts: https://abridge.netlify.app/posts/

I think you could possibly rename that directory to something else like all-posts. I am not sure I want to do this for abridge, I know /blog is fairly common, but not sure how common /posts is. (as a prefix to all individual posts)

obviously for anyone wanting to use abridge as a submodule then it would be best for me to rename it to all-posts, but that changes that url for all sites that are currently using abridge, which in my opinion is not good either, so this is one of those cases where I need to make a decision one way or another.

I will test this out in a bit and see what happens.

Jieiku commented 11 months ago

Most Zola themes that have an all posts / archive type page, use "posts" or "archive":

post: https://emily-zola-theme.netlify.app/post/

posts: https://d3c3nt.figbert.com/posts/ https://not-matthias.github.io/posts/ https://zola-sam.janbaudisch.dev/posts/ https://versbinarii.gitlab.io/blog/posts/ https://archie-zola.vercel.app/posts

posts as a section: https://deepthought-theme.netlify.app/posts/

archive: https://cydave.github.io/zola-theme-papermod/archive/ https://savoy.srht.site/blog-demo/archive https://pawroman.github.io/zola-theme-terminimal/archive/

I have changed the posts page to be archive instead of posts, which should allow you to do what you are planning to do.

You could use the transparent redirect, or a template can be referenced specifically for that section.

This is completed in the refactor branch, won't merge until next version of zola: https://github.com/Jieiku/abridge/commit/65f135a6a2f7be105bfe9ce95796b2314627b20d

Both the archive and the index templates can be referenced from a section, work for that was done here: https://github.com/Jieiku/abridge/issues/118

I just made the example content in the abridge refactor tree so that it will show the two different solutions.

a transparent section will essentially add the content to the main content directory but using the path of that section. (this is what I did for content/posts)

A regular section can also be used, this is what I did for content/blog, the _index.md in that directory points to the index.html template, but the archive.html template also supports sections.