Closed jeffp42ker closed 2 years ago
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 the case
in params->custom-fields
(for reference) to a cond
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 the cond
should be the value of the second keyword ((:title params)
) passed through the title->slug
function (maybe rename to slugify
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 change some-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.
resolves #52, maybe a little hacky yet a reference