statamic-fetch
statamic-fetch copied to clipboard
Problem with locales
Hi! I've been using Fetch for a while without any problems. Yesterday I added a second locale to a site and got into some issues.
- Primary locale works fine.
- I'm using Fetch to output JSON in a script tag with
{{ fetch pages="{ url }" }}
- I can access the correct localised data with
/!/Fetch/page/default-slug?locale=en
(en is the secondary locale in my case.) - But
/!/Fetch/page/localised-slug
gives an errorPage [localised-slug] not found.
Is this the intended behaviour? Shouldn't Fetch work with localised slugs also?
Thanks!
I got it partly working by {{ fetch pages="{default locales url}" locale="{current locale}"}}
but now all assets have wrong urls. They should stay /assets/img/image.jpg
but they become /locale/assets/img/image.jpg
.
Any help greatly appreciated! Thanks!
Hi @Burans, apologies for the late reply.
Locale-support was added to Fetch at a later stage by popular demand and hasn't been well tested/maintained if I'm honest...
Unfortunately, I won't be able to help here any time soon. Hope you find a solution/workaround for your issue!
@Burans I think this is normal behaviour inside Statamic and can be easily fixed with a symlink -> https://docs.statamic.com/localization#locales (search symlink)