Open mwickett opened 6 years ago
Hey Mike, thanks a lot for putting this out here, this is exactly the kind of example I'd like to see in this repository! π
I think a transform function fits better, but you can also implement this with a Schema Extension function.
It also needs to be adjusted heavily based on the particular project schema and naming etc.
This is perfectly fine! The way I approached this in other examples is by providing a example.graphql
schema file that can be used with the Graphcool CLI to bootstrap a project with the right structure. This way, you have something working quite fast that you can hopefully adjust easily to your own use case.
I'd love to collaborate on this! Maybe we can add another variant to the generate-slug
, or add this as a new example advanced-generate-slug
or similar?
Hey Nilan,
Thanks for looking at this. I'd love to collaborate on this with you.
I'm away this weekend and back at it on Monday.
I'll draft an example schema to go with this and post. There are probably some things we can do to abstract this a bit for more use cases. Also documenting with some places where others may need to modify would probably be good.
On July 22, 2017 at 13:41:36, Nilan Marktanner (notifications@github.com) wrote:
Hey Mike, thanks a lot for putting this out here, this is exactly the kind of example I'd like to see in this repository! π
I think a transform function fits better, but you can also implement this with a Schema Extension function.
It also needs to be adjusted heavily based on the particular project schema and naming etc.
This is perfectly fine! The way I approached this in other examples is by providing a example.graphql schema file that can be used with the Graphcool CLI to bootstrap a project with the right structure. This way, you have something working quite fast that you can hopefully adjust easily to your own use case.
I'd love to collaborate on this! Maybe we can add another variant to the generate-slug, or add this as a new example advanced-generate-slug or similar?
β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/graphcool-examples/functions/issues/24#issuecomment-317198928, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzon36RmYJDfP5GD3vfLcCFW5hzR2-hks5sQjRQgaJpZM4OaKyG .
With the help of @kbrandwijk (thank you!), I've got a much more robust slug function that seems to be working well and handling every case (that I've thought of yet).
title
value from a new record, slugifies it (using slugs, rather than regex. Handles far more inputs - unicode, other language characters, etc.))-n+1
to the end. (e.g.title-of-post-1, title-of-post-2
I feel like this could be implemented as a schema extension as well, although I'm fairly new to that, so may be wrong.
It also needs to be adjusted heavily based on the particular project schema and naming etc.
I'm putting this in as an issue to look for guidance on whether this is worth writing up an including in these function examples. And should it be a Schema extension rather than a transform function?