Postleaf / postleaf

Simple, beautiful publishing with Node.js.

Home Page:https://www.postleaf.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Special slug/url for posts

heykaley opened this issue · comments

Hi,

I love the work you put in so far. There's one thing that I am still missing though. Currently all posts and pages can get a slug e.g. domain.tld/post-name or domain.tld/page-name. It would be great if all posts would go under domain.tld/post/post-name and pages would stay with domain.tld/page-name. It would be even greater if I had the possibility to adjust the parameter for posts (so instead of domain.tld/post/post-name I could go for domain.tld/magazine/post-name). Allowing "/" in slugs would be a simple solution for now (maybe with automatically adding /post/ before /post-name/).

I hope you get the idea. Sorry, it's late and I'm German haha.

Best regards,
Kaléy.

I like this idea, and I don't think it would be too difficult to implement. Separating posts from pages is the logical thing to do and for some reason it flew under my radar until you mentioned it.

There's already a slug setting for the blog in .env so we can just tap into that.

Off the top of my head, here's what needs to be done:

  • Update router/controller to only accept /blog/{slug} for posts (prevent duplicate content)
  • Update router/controller to only accept /{slug} for pages

There might be more after diving in, but should be pretty straight forward. I'd gladly accept a PR if you're up for the task and want a faster turn around.