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.