illycz
October 11, 2019, 1:51pm
1
I’m using query for multiselect like this:
tags:
label: Category
type: multiselect
options: query
query:
fetch: site.find("news").tags.split
text: "{{ arrayItem.value }}"
value: "{{ arrayItem.value.slug }}"
And I’m also generate tag href like this:
<?= url($page->url(), ['params' => ['tag' => Str::slug($tag)]]) ?>
What is confusing that the values is not same.
Tag name Компания+События
is saved for article as kmpnija-sbytija
and the href is domain.com/ru/news/tag:kompaniya-sobytiya
What I’m doing wrong?
Thanks
Have you set the slug language in your config? https://getkirby.com/docs/reference/system/options/slugs
To be honest, I’d leave the values as is when storing them and instead urlencode()
and decode them.
I had a look at the source code and the slug
field method actually uses Str::slug
internally. If I add this string Компания События
as a tag name, it is in fact converted to kompanija-sobytija
in the select field.
Are you running 3.2.5 or an older version?
illycz
October 12, 2019, 4:18pm
3
I had 3.2.3. After upgrade, everything working as expected
illycz
October 12, 2019, 4:58pm
4
Nooo!
Different problem, kompanija-sobytija
vs kompaniya-sobytiya
.
I don’t know where is the problem
illycz
October 12, 2019, 5:19pm
5
I’m posted this to existing (now closed) issue: https://github.com/getkirby/kirby/issues/1903#issuecomment-541344389
Maybe it’s related.
echo Str::slug('Компания События');
// result: kompanija-sobytija
If I store this in a tags field
Tags: Компания События
Call it in my blueprint with the query you used above, it
shows me this in the Panel
and stores this result for the select field:
Tags: kompanija-sobytija
So this probably looks like it should?
Are you testing this on a remote server or locally? Which environment?
illycz
October 12, 2019, 5:47pm
7
echo Str::slug('Компания События');
// result kompaniya-sobytiya
Locally within MAMP. PHP 7.2.1
illycz
October 12, 2019, 5:51pm
8
I’m get it!
I have multilanguage setup.
I’m getting kompaniya-sobytiya
only on RU lang pages.
Others return kompanija-sobytija
.
So how can I solve this?
Some settings on ru language perhaps?
Thanks, you are awesome!
Hm, maybe it depends on your server settings. What would be the expected result, j
or y
? But at least it should be consistent.
illycz
October 12, 2019, 5:53pm
10
I agree that it should be consistent. I don’t know what is expected result, I’m not from Russia
texnixe
October 12, 2019, 5:53pm
11
Have you set your slug languages in your language files? And why would you use the Russian slug in other languages anyway?
You can, however, define what characters should be sluggified in which way: https://getkirby.com/docs/guide/languages/slug-rules
illycz
October 12, 2019, 6:03pm
12
When I set it to ‘en’ I’m getting still same results. Do you mean slugs option in config?
The problem is, that saved tag has different slug than param generated in template. Do you understand what I mean?
Yes, I know about it, but I don’t undestand RU alphabet and I don’t know how much inconsistencies may be…
texnixe
October 12, 2019, 6:09pm
13
Yes, but you can do that on a per language basis.
Hm, I guess I should test this in a multi-language environment.
illycz
October 12, 2019, 6:21pm
14
There is only slug option in language settings which is for different mapping, or I’m missing something?