Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use lowercase comparison for taxonomy terms #1733

Closed
wants to merge 1 commit into from

Conversation

chrisjung-dev
Copy link
Contributor

Since the URI params only get returned lowercase in 1.3.8, the comparison for the use of the terms of the taxonomy should search in a lowercase version of the pages taxonomy maps.

This will result in a loss of the case sensitivity of taxonomy terms.

Term1 and term1 will be the same.

fixes: #1729

Since the URI params only get returned lowercase in 1.3.8, the comparison for the use of the terms of the taxonomy should search in a lowercase version of the pages taxonomy maps.

This will result in a loss of the case sensitivity of taxonomy terms.

Term1 and term1 will be the same.

fixes: getgrav#1729
Copy link
Member

@rhukster rhukster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rather than doing the lowercasing here at 'runtime' so to speak, it should be done in the header() method when the taxonomy items are actually parsed from the header and stored in the local taxonomy array (line 409-411)

@chrisjung-dev
Copy link
Contributor Author

chrisjung-dev commented Nov 2, 2017

Since Taxonomy terms are not part of i18n, this would remove the possibility to have uppercase letters in terms. Is my understanding of this correct?

For using Tags, this may be acceptible, for custom taxonomies this may be not correct in general.

In my case, it makes a huge difference for the german translation. In en locale, that's okay. "hot chocolate". But in german the category is "Trinkschokolade" and "trinkschokolade" would just look very unprofessional. Such things may occur for other people using Grav as well.

Plus it will possibly change data for existing installations unexpected and without further notice.

@chrisjung-dev
Copy link
Contributor Author

chrisjung-dev commented Nov 2, 2017

@rhukster
Copy link
Member

rhukster commented Nov 2, 2017

Actually!!!!!

I tested a tag of Franky Smith on my local test setup and it worked fine....

I was thinking that the URL as being lowercased because of this:

https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Uri.php#L294-L297

Turns out that was a user contribution, but no case_insensitive_urls is actually set in the default system.yaml. So by default this would be null, unless you saved configuration from admin then it would be false. Both of these would skip the lowercasing of the URL.

If however you set this to true in your configuration, then your URL is being lowercased, and the Franky Smith filter no longer works. I think this new setting is not actually correct and is causing the confusion. Do you have this enabled on your site?

I'm going to look at changing this functionality so:

  1. it's more clear
  2. it only lowercases the route, and not anything else.

@rhukster
Copy link
Member

rhukster commented Nov 2, 2017

Actually i've reverted the pull completely. I realized that when enabled that broke quite a few things.

@chrisjung-dev
Copy link
Contributor Author

case_insensitive_urls: true in my installation. That was added 25th of October without having changed this value in admin. Saving the settings occured but not this setting.

@chrisjung-dev
Copy link
Contributor Author

In fact this also breaks the latest changes to the taxonomylist-plugin. Setting this to false then doesn't need to set the | lower filter.

@rhukster
Copy link
Member

rhukster commented Nov 2, 2017

Yah i've actually removed that case_insensitive_url option completely.. its no longer even used.. will be in next release (setting to false will get you by for now).

Also i've re-released Taxonomy plugin with that lowercase filter removed. So pretty soon, things should be back to normal!

@chrisjung-dev
Copy link
Contributor Author

That's great to hear and thanks for your patience and understanding.

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.

[1.3.8] Taxonomies seem to work with lowercase entries only
2 participants