Closed
Description
Bug description
I have a collection Trainer-Led Learning
which is configured to use the route /trainer-led-learning/{slug}
.
I have a taxonomy Staff Groups
which is linked to the collection.
When using the {{ taxonomy }}
tag, the {{ url }}
that is produced links to /trainer_led_learning/staff-group/{slug}
.
I'm not sure if it is intentional that the -
in the collection slug is replaced by _
. I assume the taxonomy is using the collection handle to generate urls, and does not respect its configured route? Interesting it doesn't use the taxonomy handle too ie /trainer_led_learning/staff_groups/term
How to reproduce
- Create a collection
Trainer-Led Learning
. - Scaffold views
- Configure its route to
/trainer-led-learning/{slug}
- Create a taxonomy
Staff Groups
. - Create views
/trainer_led_learning/staff_groups/{index, show}.antlers.html
- In the
index
view, loop over the taxonomy:
<ul>
{{ taxonomy:staff_groups collection="trainer_led_learning" }}
<li><a href="{{ url }}">{{ title }}</a></li>
{{ /taxonomy:staff_groups }}
</ul>
Expected output:
<ul class="list-disc">
<li><a href="http:/example.com/trainer-led-learning/staff-groups/term-1">{{ title }}</a></li>
<li><a href="http:/example.com/trainer-led-learning/staff-groups/term-2">{{ title }}</a></li>
</ul>
Actual output:
<ul class="list-disc">
<li><a href="http:/example.com/trainer_led_learning/staff-groups/term-1">{{ title }}</a></li>
<li><a href="http:/example.com/trainer_led_learning/staff-groups/term-2">{{ title }}</a></li>
</ul>
Logs
Environment
Environment
Application Name: Statamic
Laravel Version: 11.41.3
PHP Version: 8.2.27
Composer Version: 2.8.4
Environment: local
Debug Mode: ENABLED
URL: taxonomy-slug-bug.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file
Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.46.1 Solo
Installation
Fresh statamic/statamic site via CLI
Additional details
If this is indeed a bug, I'm happy to look into it 😃