For my view in Drupal 8 I have added a sorting criteria based on the custom field. Now, when I sort the content in the url one can see a sorting value as a name of that field.

Like ?sort_by=field_custom_value

How can I override the value of the sort criteria, so that the path doesn't look so ugly.

Expected: ?sort_by=something_different

Change the machine name of the custom field. If you haven't used the field for much yet, that is a quick solution.

If you already have a lot of nodes with data in that field, create a new field with a nicer machine name and copy the data from the old field to the new field. There are a variety of ways to do this, but you might want to try Views Bulk Operations or Feeds Tamper.

  • You can change the name of it in the filter config I believe. – Kevin Nov 26 at 14:47
  • Not for sorting criteria unfortunately – koal Nov 26 at 15:19

This module might help Query Parameters To URL.

There's a D8 sandbox: Drupal 8 port

The module seems very useful, maybe it would get more attention if more people used it.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.