We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28173
    • 409 Posts
    Hi,

    I try to use Revo for a new project smiley
    I have a little problem with the friendly alias autogeneration.

    I have accentuated pagetitle like "Présentation" and I want the alias "presentation"

    I didn’t found in the documentation the options available for the parameters friendly_alias_restrict_chars_pattern

    Is something like this is correct for this parameter :
    /[\0\x0B\t\n\r\f\a&=+%#<>"~`@\?\[\]\{\}\|\^'\\]/éèëàáãäïíìõöóòüúùÿýñ
      • 16848
      • 3 Posts
      Simple solution to replace accents in alias on Modx Revolution :

      The magic trick => "urlencode"

      Place this code in : /core/model/modx/modressource.class.php => line 369 just before "return $alias" :

      // =================================================================================================================

      $alias = urlencode($alias);

      $a = array("c3a0","c3a1","c3a2","c3a3","c3a4","c3a5","c3a0","c3a1","c3a2","c3a3","c3a4","c3a5","c3b2","c3b3",
      "c3b4","c3b5","c3b6","c3b8","c3b2","c3b3","c3b4","c3b5","c3b6","c3b8","c3a8","c3a9","c3aa","c3ab","c3a8","c3a9",
      "c3aa","c3ab","c3a7","c3a7","c3ac","c3ad","c3ae","c3af","c3ac","c3ad","c3ae","c3af","c3b9","c3ba","c3bb","c3bc",
      "c3b9","c3ba","c3bb","c3bc","c3bf","c3b1","c3b1");

      $b = Array("a","a","a","a","a","a","a","a","a","a","a","a","o","o","o","o","o","o","o","o","o","o","o","o","e","e",
      "e","e","e","e","e","e","c","c","i","i","i","i","i","i","i","i","u","u","u","u","u","u","u","u","y","n","n");

      $alias = str_replace($a, $b, $alias);

      // =================================================================================================================

      grin
        • 19534
        • 183 Posts
        Instead of maintaining huge arrays of chars to replace you might use this:

        $alias = iconv('UTF-8', 'ASCII//TRANSLIT', $alias);
        


        See http://php.net/manual/en/function.iconv.php for more information.
          Add-On to easily manage your multilingual sites: Babel
          • 36686
          • 165 Posts
          I tried all your suggestions, and Spheerys suggestion results in no alias being created at all. Lechmit’s solution replaces a page title of åäö with %C3%A5%C3%A4%C3%B6. Jakob’s solution results in the characters being replaced by questionmarks: huh.

          Neighther of these seems like good solutions - is there any way to replace characters with umlauts etc with the equivalent but without the unlauts, i.e. åäö becomes aao?

          Using MODx Revo 2.0.6
            • 28173
            • 409 Posts
            I really don’t understand why the alias encoding is always difficult under MODx
            It should easy to select the generation mode !

            Isn’t there a consensus about the "standard" of a auto-generated alias ? (ie. : no accent, no space, ü=ue of german language...)
              • 3749
              • 24,544 Posts
              I think it’s controlled by a fairly restrictive preg_replace in the resource/create processor.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 22303 MODX Staff
                • 10,725 Posts
                The automatic alias generation is completely and 100% configurable in Revolution. There is a great variety of options available under the Friendly URL area in System Settings.
                  • 3749
                  • 24,544 Posts
                  I stand corrected. tongue

                  I wonder if the OP has a character set problem rather than a configuration problem.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 28173
                    • 409 Posts
                    Quote from: OpenGeek at Jan 05, 2011, 05:33 PM

                    The automatic alias generation is completely and 100% configurable in Revolution. There is a great variety of options available under the Friendly URL area in System Settings.
                    OK but :
                    - is there a tutorial about this configuration (I didn’t found it) ?
                    - why the default configuration leave the accentuated characters in the alias ?
                      • 36686
                      • 165 Posts
                      The automatic alias generation is completely and 100% configurable in Revolution. There is a great variety of options available under the Friendly URL area in System Settings.

                      OpenGeek, I’m guessing you’re referring to the setting friendly_char_restrict_chars? The choices there are pattern, legal, alpha and alphanumeric, but neither of those treat characters with umlauts in a satisfactory way as far as I can tell. Is there an option which subsititutes åäö with aao? Just removing the characters from the alias is really bad from a SEO and usability perspective for those of us using languages with frequent occurances of umlauts and accented characters (Swedish, Norwegian, German, French, Spanish etc).