Closed jacobobryant closed 2 years ago
I did see :slugify
in config.edn.
I submitted a PR that infers the slug for Posts, just because I found a place to put it that seems to work.
I see path
replaces slug
in the Pages fields config so pages are unaffected.
From https://github.com/jacobobryant/platypub/pull/53#issuecomment-1208522826:
mm--yes, it is hacky :). Ideally we wouldn't want platypub code (i.e., anything under
src/
) to ever reference any specific field names like:slug
or:title
. For a proper solution we'd want to change thecase
inparams->custom-fields
(for reference) to acond
or something. Then we can handle "special" types, e.g. in this case if the type is a vector that starts with:slugify
, like[:slugify :com.platypub.post/title]
, then the return value of thecond
should be the value of the second keyword ((:title params)
) passed through thetitle->slug
function (maybe rename toslugify
or->slug
).If we want to add any other inferred field types later on, we can follow the same pattern.
Also I suppose we could change the default theme so it also uses
[:slugify :com.platypub.post/title]
for the type of:com.platypub.page/path
. It should work fine as long as the theme knows to changesome-path
to/some-path
, which I think it already does.I'll go ahead and merge, but I'll leave the issue open and quote this there.
I just remembered that when I overhauled the data model I never got around to making https://github.com/jacobobryant/platypub/issues/26 still work. It's more difficult now since everything related to posts must be done generically. I did include something in the config for this, but platypub doesn't actually do anything with that yet. I also am not really sure how exactly that should work. probably needs more thinking.