Using the value of a relationship fieldtype in collection routes #6650
Answered
by
duncanmcclean
duncanmcclean
asked this question in
Troubleshooting
-
We have a custom Relationship fieldtype which we'd like to use in our collection route like so but it doesn't seem to work... route: '/locations/{location:slug}/apartment-types/{slug}' But this does work (without the route: '/locations/{location}/apartment-types/{slug}' We are returning an augmented array from our custom Location fieldtype - it returns the augmented array from an entry. Is there any way to workaround the issue we're running into (without having to build custom routes?) |
Beta Was this translation helpful? Give feedback.
Answered by
duncanmcclean
Mar 4, 2024
Replies: 1 comment 3 replies
-
I wasn't been able to find the solution other that custom template which retrieves the entries from the collections by their slugs. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can workaround this by creating a Computed Value to return any related fields you want to use in your collection route.
For example, you could do something like this:
Then, the collection's route would use that computed value like this:
/locations/{location_slug}/{slug}
.If you want this to be supported in future version of Statamic, add a 👍 reaction to this feature request: statamic/ideas#360