Url Alias question

Author Message

Carlos Revillo

Friday 17 July 2009 5:02:00 am

Hi. I've got a question about url_alias. Suppose i have an article under a structure like this

then i do an url_alias so if a user types only 'article' he will get that article under that structure.

But, while doing a fetch, content, list under folder5, is there any way to show url_alias and not the entire path to the article? i mean, suppose folder5 has node_id = 100.
if i do

{$articles = fetch('content', 'listh', hash('parent_node_id', 100)}
{foreach $articles as $article}
<a href={$article.url_alias|ezurl()}>{$article.name}</a>
{/foreach}

url_alias is always like

folder1/folder2/folder3/folder4/folder5/article

but i would like to find a way to show the new url alias created for that node... is there any easy way to do this?

thanks.

Max Keil

Friday 17 July 2009 5:17:09 am

Hi Carlos,

if you know your url-alias, why are you do not display this?

Mit freundlichen Grüßen
Best regards

Max Keil

____________________________________________________________
eZ Publish Gold Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Carlos Revillo

Friday 17 July 2009 5:31:06 am

Hi Max.

I don't really know if i really understand your question. Maybe my first post is not really clear.

what i want is:

If something types http://myhost/article in browser, he will showed the article at http://myhost/folder1/.../folder5/article. i don't want 301 redirection, so i choose 'direct type'.

Then, while listing the articles under folder5 i want that href will look like
<a href="/article">... and not <a href="/folder1/folder2/.../folder5/article">

if i use {$node.url_alias|ezurl} i always get that long path, and i would like to show the url_alias i've created for that deep node.

It's a question about usability and seo... i mean, suppose i have something like

news
------sports
-----------basketball
-----------------------nba.

then i create an url_alias. if something types nba he will be showed that deep node. for everybody it will be easy to remenber something like http://myhost/nba than http://myhost/news/sports/basketball/nba

but if tell other websites to link me at http://myhost/nba, having in my own listing things like http://myhost/news/sports/basketball/nba, spiders may think about duplicated content...

Gaetano Giunta

Friday 17 July 2009 7:49:05 am

Why then don't you just publish your article at two locations?
This way you do not need to set up an url alias rule, and when you fetch the object in your code you can always get the url_alias of its main node.

As for crawlers that might dislike finding the object at two locations, I suspect it is an over-rated problem.
Here anyway http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html it says that you just need to add <link rel="canonical" ...> to your pages to tel elgoog that mant different urls refer to the same content. And you can add that to your page wheter you are using multi-location, url-alias or any other stuff.

Tip: to avoid fetching again the current node in the pagelayout to get the canonical url out of it, you might use the persistent_variable...

Principal Consultant International Business
Member of the Community Project Board

Carlos Revillo

Friday 17 July 2009 11:12:31 am

Hi Gaetano.

Your solution seems to be the better one. i will have to implement some kind of workflow to add a location to the object after it is published.

i was looking for a way to do some kinda

{$node.my_custom_url_alias|ezurl()}

being that my_custom_url_alias the one i added, but this doesn't seem to be easy.

i will go for two locations for the objects. thanks.

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 18 2025 18:24:55
Script start
Timing: Jan 18 2025 18:24:55
Module start 'layout'
Timing: Jan 18 2025 18:24:55
Module start 'content'
Timing: Jan 18 2025 18:24:55
Module end 'content'
Timing: Jan 18 2025 18:24:55
Script end

Main resources:

Total runtime0.0139 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.9297152.6094
Module start 'layout' 0.00510.0025 741.539139.4297
Module start 'content' 0.00760.0043 780.968893.4297
Module end 'content' 0.01200.0019 874.398438.3047
Script end 0.0139  912.7031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002416.9773140.0002
Check MTime0.00107.5506140.0001
Mysql Total
Database connection0.00085.559710.0008
Mysqli_queries0.002215.981030.0007
Looping result0.00000.094310.0000
Template Total0.001511.010.0015
Template load0.00085.890610.0008
Template processing0.00075.057210.0007
Override
Cache load0.00053.947710.0005
General
dbfile0.00032.085380.0000
String conversion0.00000.049740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs