grantcodes / postr

An extendable IndieWeb backend
https://postr.dev
24 stars 1 forks source link

Permalink pattern based on post type #61

Open MaybeThisIsRu opened 4 years ago

MaybeThisIsRu commented 4 years ago

So at the moment, I'm making use of Indiekit and wanted to try out Postr as it offers native syndication as well as automatic webmentions.

The URL on my static site is modelled like so for notes: /notes/:year/:month/:day/:slug

When I add other post types, I intend to change the URL scheme to something along the lines of /micro/:postType/:year/:month/:day/:slug.

For greater configurability, something like the following would be more preferable:

permalinkPattern: {
  note: '/micro/notes/:year/:month/:day/:slug',
  like: '/micro/likes/:year/:month/:day/:slug'
}

Some may prefer using notes while some may prefer using note for example. This takes care of that by letting them specify it.

Is it already possible to specify the post type to be a part of the permalink? If not, would you consider adding this feature at some point, or alternatively, accept a PR? I don't know if I'll get around to a PR at all, but would be lovely to know what your thoughts are.

grantcodes commented 4 years ago

Yeah that's probably a good idea to be able to have the post type in the urls. But there is a problem that some people may want plural words, some single and some may want to translate them.

But I don't like the idea of having different patterns per post type.

I think maybe a better option would be to be able to give custom functions to the config. I can't quite remember 100% what the pattern is used for but it is definitely used to convert mf2 json to a url and to generate a database search from a url.

grantcodes commented 4 years ago

Also definitely happy to accept PRs!

MaybeThisIsRu commented 4 years ago

A quick update: I tried Postr out recently and currently do not intend to use it. If anyone else would like to pick this up and open a PR, please feel free!