Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-28811

As an Administrator I want to decide which pattern should be used in URL generation

    XMLWordPrintable

Details

    • [2.2] Sprint 4
    • 2

    Description

      The customer asked for the way to change how generated URLs looks like.
      The customer expects URLs like: www.example.com/example-article and I think that we should provide some easy way to configure this behavior.

      Currently, out-of-box it is www.example.com/Example-Article. Moreover, you can set-up SlugConverter to use urlalias_compat, but then generated URL will look like: www.example.com/example_article.

      In theory, you can manipulate that configuration by the service definition. You can pass own configuration there:

      services:
          ezpublish.persistence.slug_converter:
              class: "%ezpublish.persistence.slug_converter.class%"
              arguments: ["@ezpublish.api.storage_engine.transformation_processor", "%slug_configuration%"]
      
      parameters:
          slug_configuration:
              transformation: urlalias
              transformationGroups:
                  urlalias:
                      commands:
                          - ascii_lowercase
                          - cyrillic_lowercase
                          - greek_lowercase
                          - latin1_lowercase
                          - latin-exta_lowercase
                          - latin_lowercase
                      cleanupMethod: url_cleanup
              wordSeparatorName: dash
      

      but, thanks to "+" in https://github.com/ezsystems/ezpublish-kernel/blob/6.13/eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/SlugConverter.php#L154 it won't work. Whole configuration array will be immediately overwritten. You will get a lot of exceptions because back-end still uses urlalias_compat which is overwritten using the mentioned configuration.
      Ultimately, you can make it work, but it requires a lot of configuration in parameters, something like:

      parameters:
          slug_configuration:
              transformation: urlalias
              transformationGroups:
                  urlalias:
                      commands:
                          - ascii_lowercase
                          - cyrillic_lowercase
                          - greek_lowercase
                          - latin1_lowercase
                          - latin-exta_lowercase
                          - latin_lowercase
                          - space_normalize
                          - hyphen_normalize
                          - apostrophe_normalize
                          - doublequote_normalize
                          - greek_normalize
                          - endline_search_normalize
                          - tab_search_normalize
                          - specialwords_search_normalize
                          - apostrophe_to_doublequote
                          - math_to_ascii
                          - inverted_to_normal
                          - special_decompose
                          - latin_search_decompose
                          - cyrillic_transliterate_ascii
                          - greek_transliterate_ascii
                          - hebrew_transliterate_ascii
                          - latin1_transliterate_ascii
                          - latin-exta_transliterate_ascii
                          - cyrillic_diacritical
                          - greek_diacritical
                          - latin1_diacritical
                          - latin-exta_diacritical
                      cleanupMethod: url_cleanup
              wordSeparatorName: dash
      

      plus all configuration for urlalias_compat and urlaslias_iri.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamil.madejski@ibexa.co Kamil Madejski
            Votes:
            3 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: