Page Paths URL Won't Update Properly

Permalink 1 user found helpful
I have no idea why this is happening. I created a page named Before / After.

I'm not sure what the default path was that it created, but I have since tried to change it many times. For some reason it won't let me keep the word 'before' in the page.

The current path is 'after-photos' and I'm trying to update it to 'before-after-photos'. After I update the path, if I look at the page properties the Canonical URL remains the same (after-photos).

Has anyone ever experienced this before?

Just to be clear, it's only the word 'before' that it's not accepting. If I try to update it to something else, for example 'after-photos-new', it saves the new path correctly without any issues.

Hopefully I can get some insight into what's going on. Thanks!

roketto
 
Remo replied on at Permalink Reply
Remo
This is actually easier to explain that one might think.

concrete5 uses a library called urlify to get rid of special characters and certain words in the URL. ü becomes u (should be ue for lots of people by the way), "an" is removed and so is "before".

You can have a quick look at this file:https://github.com/jbroadway/urlify/blob/master/URLify.php...

Search for before and you'll understand where the file is removed.

What can you do in this case:
* You can use the on_page_urlify event, in an add-on you'd have to build, to intercept calls to urlify and call something else. Keep in mind that this is only available in 5.6.1 with this pull request:https://github.com/concrete5/concrete5/pull/877...
* You can override the URLify library in your site and remove the words like "before" you want to keep in the page path.

Hope this helps!
roketto replied on at Permalink Reply
roketto
Thanks Remo.

I'm gonna go the route of overriding the URLify library. Appreciate the help!
roketto replied on at Permalink Reply
roketto
Hey Remo,

I tried overriding the urlify.php file like so:

1. Created the file [site root]/libraries/3rdparty/urlify.php
2. Pasted the original code into the urlify.php file, deleted 'before' from the remove list

I tried clearing my cache, but I'm still unable to add 'before' the url path.

Have I done this correctly?
Remo replied on at Permalink Best Answer Reply
Remo
Works fine for me! Depending on the version you're using, clearing the cache might not be enough. Try to disable the override cache or maybe all caches just to see if it makes any difference.
roketto replied on at Permalink Reply
roketto
I think maybe I'm doing this wrong...

Here's the code I edited:

/**
    * List of words to remove from URLs.
    */
   public static $remove_list = array (
      'a', 'an', 'as', 'at', 'but', 'by', 'for', 'from',
      'is', 'in', 'into', 'like', 'of', 'off', 'on', 'onto', 'per',
      'since', 'than', 'the', 'this', 'that', 'to', 'up', 'via',
      'with'
   );


As you can see I'm simply removed the word 'before' so that it is no longer listed in the urlify.php file. Still having the same troubles. Just can't get 'before' to be a part of my pages path, even after clearing my cache.

Any ideas?
hamsterbacke82 replied on at Permalink Reply
Why would you even want to edit code for this? 5.6.1 introduced a dashboard interface for adding or removing words from that list
Remo replied on at Permalink Reply
Remo
Because this isn't multi lingual. Some people have complex multilanguage sites where these rules are different per language.
roketto replied on at Permalink Reply
roketto
I didn't know that... I would have used this feature had I been aware.

Where through the dashboard can I find this?
Remo replied on at Permalink Reply
Remo
roketto replied on at Permalink Reply
roketto
I got it to work! Overrides caching was turned off, but I still had basic caching on. I turned all caching off and cleared my cache. Now it seemed to work!

Cheers :)