Change the URL/URI separator

Author Message

Dominic Luechinger

Thursday 28 December 2006 4:25:07 pm

Is there a possibility to change the URL separator (by default: "_") in the ez publish.
The problem is, that this constitution isn't usefull for SEO (Search engine optimization), because a link like http://ez.no/company/contact_form will be interpreteted as "contact_form" and not as "contact","form".
See more on: http://www.prweaver.com/blog/2004/08/26/2-hyphen-and-underscore

Thank's

kracker (the)

Friday 29 December 2006 2:23:23 am

I've heard a lot of talk about this feature request.
I hear it's ... complicated and deeply involved.

That said back in 2003 it did not seem so complicated,
<i>http://ez.no/community/forum/setup_design/nice_url_delimiter_change_to_</i>

While the above thread is 'a' starting point,
It seems much of this functionality has since been abstracted a few times.

Follow the php code's execution order...
file, 'kernel/classes/ezcontentobjecttreenode.php', function 'pathWithNames()'
file, 'kernel/classes/ezurlalias.php', function 'convertToAlias()'

  /*!
     \static
     Converts the path \a $urlElement into a new alias url which only conists of characters
     in the range a-z, numbers and _.
     All other characters are converted to _.
     \return the converted element

     \example
     'My car' => 'my_car'
     'What is this?' => 'what_is_this'
     'This & that' => 'this_that'
     'myfile.tpl' => 'myfile_tpl',
     '<F8><E6><E5>' => 'oeaeaa'
     \endexample
    */
    function convertToAlias( $urlElement, $defaultValue = false )
    {
        include_once( 'lib/ezi18n/classes/ezchartransform.php' );
        $trans =& eZCharTransform::instance();

        $urlElement = $trans->transformByGroup( $urlElement, 'urlalias' );
        if ( strlen( $urlElement ) == 0 )
        {
            if ( $defaultValue === false )
                $urlElement = '_1';
            else
            {
                $urlElement = $defaultValue;
                $urlElement = $trans->transformByGroup( $urlElement, 'urlalias' );
            }
        }
        return $urlElement;
    }

file, 'lib/ezi18n/classes/ezchartransform.php', function 'transformByGroup()'
file, 'lib/ezi18n/classes/ezcodemapper.php', function 'executeCommandCode()'

 function executeCommandCode( &$text, $command, $charsetName )
    {
        if ( $command['command'] == 'url_cleanup' or
             $command['command'] == 'identifier_cleanup' )
        {
            $text = strtolower( $text );
            $text = preg_replace( array( "#[^a-z0-9_ ]#",
                                         "/ /",
                                         "/__+/",
                                         "/^_|_$/" ),
                                  array( " ",
                                         "_",
                                         "_",
                                         "" ),
                                  $text );
            return true;
        }

I believe with some tinkering around here and perhapses a few other locations in the code (one edit for interpretation and one edit for generation ... of-urls-using-dashes-rather-than-underscores) the theory is it's possible. Though this could open up other as of yet unknown breakdowns resulting from these modifications which would need to be addressed for a complete solution.

<i>//kracker
the lifestyle of private modifications which never see distribution is a sad one indeed ... contribute to your local community!</i>

<b>Related threads</b>
<i>http://ez.no/community/forum/general/usability_and_seo
http://ez.no/community/forum/suggestions/url_rewriting_and_whitespaces
http://ez.no/community/forum/general/seo_and_page_head
http://ez.no/community/forum/suggestions/better_urls</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 00:11:46
Script start
Timing: Jan 19 2025 00:11:46
Module start 'layout'
Timing: Jan 19 2025 00:11:46
Module start 'content'
Timing: Jan 19 2025 00:11:47
Module end 'content'
Timing: Jan 19 2025 00:11:47
Script end

Main resources:

Total runtime1.0519 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 587.9141152.6250
Module start 'layout' 0.00710.0031 740.539139.4453
Module start 'content' 0.01021.0405 779.9844547.8750
Module end 'content' 1.05070.0011 1,327.859412.1641
Script end 1.0518  1,340.0234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3091160.0002
Check MTime0.00120.1186160.0001
Mysql Total
Database connection0.00130.127810.0013
Mysqli_queries1.003095.3585540.0186
Looping result0.00050.0496520.0000
Template Total1.015696.620.5078
Template load0.00220.209020.0011
Template processing1.013496.341020.5067
Template load and register function0.00010.013310.0001
states
state_id_array0.00140.132410.0014
state_identifier_array0.00140.134820.0007
Override
Cache load0.00180.1737300.0001
Sytem overhead
Fetch class attribute can translate value0.00060.053420.0003
Fetch class attribute name0.00090.080930.0003
XML
Image XML parsing0.00070.070620.0004
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00150.1431180.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs