Skip to content

[6.x] Add routes control (and localization) to taxonomies - #8627

Closed
ryanmitchell wants to merge 20 commits into
statamic:6.xfrom
ryanmitchell:feature/localizable-taxonomy-routes
Closed

[6.x] Add routes control (and localization) to taxonomies #8627
ryanmitchell wants to merge 20 commits into
statamic:6.xfrom
ryanmitchell:feature/localizable-taxonomy-routes

Conversation

@ryanmitchell

@ryanmitchell ryanmitchell commented Aug 25, 2023

Copy link
Copy Markdown
Contributor

You may have something else entirely in mind for this, but I had a bit of free time and thought it worth working on.

This PR adds the ability to specify routes in the taxonomy config:
Screenshot 2023-08-25 at 14 15 27

And allows them to be localized:
Screenshot 2023-08-25 at 14 15 30

Im sure theres stuff I haven't thought through, but hey its a start.

Closes #2403
Closes #2334

Edit:
One of the differences between this and collection routes is that we are trying to make it work for both the 'taxonomy' view and the 'term' view. It occurred to me that we could allow the routes to be more like the collection routes in that the {slug} could be specified in the route, and we take everything up to /{slug} as the 'taxonomy' route. I guess another option would be to specify seperate routes for taxonomy and terms.

@ryanmitchell ryanmitchell changed the title Add routes control (and localization) to taxonomies [4.x] Add routes control (and localization) to taxonomies Aug 25, 2023
@godismyjudge95

Copy link
Copy Markdown
Contributor

This PR looks exactly like what I need. Currently having to do an unwieldy Laravel route that does the term/taxonomy fetching, etc.

Am I right in assuming this will prefetch the entries associated with the tax/term? I think currently it does this without customizing the url, just wanted to make sure it doesn't mess it up.

Edit: One of the differences between this and collection routes is that we are trying to make it work for both the 'taxonomy' view and the 'term' view. It occurred to me that we could allow the routes to be more like the collection routes in that the {slug} could be specified in the route, and we take everything up to /{slug} as the 'taxonomy' route. I guess another option would be to specify seperate routes for taxonomy and terms.

I like the semantics of this - being able to specify both the tax archive page and the term archive page.

@ryanmitchell

Copy link
Copy Markdown
Contributor Author

Am I right in assuming this will prefetch the entries associated with the tax/term? I think currently it does this without customizing the url, just wanted to make sure it doesn't mess it up.

Correct.

Comment thread src/Taxonomies/LocalizedTerm.php
@godismyjudge95

Copy link
Copy Markdown
Contributor

I have run into another issue with this setup. Sometimes I want to nest the terms on a page like so:

parent_page/term_name

Perhaps this is a use case that shouldn't be supported by Statamic by default, but in my opinion it would be nice to have as robust routing features for terms as we have for entries.

@ryanmitchell

Copy link
Copy Markdown
Contributor Author

@godismyjudge95 it still follows the index/show approach, so you could mount it on parent_page/taxonomy_handle/term_name.

If you want direct mounting, consider using a collection.

@isaackearl

Copy link
Copy Markdown

I too, am a fan of the idea of being able to customize my taxonomy routes.

@ryanmitchell ryanmitchell changed the title [4.x] Add routes control (and localization) to taxonomies [5.x] Add routes control (and localization) to taxonomies May 10, 2024
@aerni

aerni commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

@ryanmitchell Does this remove the automatic taxonomy routing? Because I ran into a bug with it and will hold off fixing it if this PR removes it anyway.

@ryanmitchell

Copy link
Copy Markdown
Contributor Author

@aerni it doesn’t remove it but allows you to do something instead of it

@aerni

aerni commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

@ryanmitchell You might want to take a look at this PR. Just to ensure we don't conflict. #10398

@ryanmitchell

Copy link
Copy Markdown
Contributor Author

@aerni doesn't seem to conflict

@fabiangigler

fabiangigler commented Sep 13, 2024

Copy link
Copy Markdown
Contributor

I came here from #2403, and am looking to define the route as a query parameter to something like this /blog?tag=guide. Will this be supported through this PR?

If not, would there need to be a seperate field to overwrite the URL used for the "Visit URL" button here? For the live preview this is currently already working in v5.
grafik

@ryanmitchell

Copy link
Copy Markdown
Contributor Author

it would. but this PR has been sitting a long time, I wouldnt rely on it getting merged!

@fabiangigler

Copy link
Copy Markdown
Contributor

indeed!

@jasonvarga are there any blockers or conflicts preventing this merge here? seems like a very sensible addition.

@robdekort

Copy link
Copy Markdown
Contributor

Am I right in thinking this PR, together with a future option to make taxonomies mountable (so you can optimize those pages for SEO) would make them great again?

@justkidding96

Copy link
Copy Markdown
Contributor

@jasonvarga @duncanmcclean Any update on this?

@duncanmcclean

Copy link
Copy Markdown
Member

Sorry, we don't have an update on this. When we do, we'll update this PR.

@fabiangigler

Copy link
Copy Markdown
Contributor

Let us know if anything's missing that the community could contribute :)

@duncanmcclean duncanmcclean changed the title [5.x] Add routes control (and localization) to taxonomies [6.x] Add routes control (and localization) to taxonomies Jan 28, 2026
@duncanmcclean
duncanmcclean changed the base branch from 5.x to 6.x January 28, 2026 17:35
@jasonvarga

Copy link
Copy Markdown
Member

😅 Thanks for the work on this. Closing now though as this is quite stale, and it'll all be covered by #15192 !

@jasonvarga jasonvarga closed this Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Localizable Taxonomy Routes Custom Taxonomy Routes

9 participants