Developer forum

Forum » Development » Linking to page in another layer

Linking to page in another layer


Reply
Hi there,

I have a page in a Dutch language layer (for a .nl domain) that I want to link to another page in an English layer (with a .com) domain.

I also enabled "Ensure unique paths" in the Customized URLs module which causes the link to break. Instead of also modifying the domain name, the link in the Dutch layer tries to redirect to:

domainname.nl/DutchName.aspx

instead of

domainname.com/EnglishPageName.aspx

Is there a way around this, other than hardcoding the URL? I could do it, but it would mean creating separate design templates and XSLT templates to add the link to the Dutch layer, or it would mean writing a custom MenuProvider.

Imar

UPDATE: Modified the page name in the Dutch layer to DutchName which it should have been in the first place.

Replies

 
Nicolai Høeg Pedersen
Reply
Did you set primary domain on the 2 language layers? Otherwise it will not work if you have 2 pages with the same name on 2 different language layers.
 
Reply
Yes, I set the primary domain on both web sites (.nl for the Dutch layer, and .com for the English layer).

Both pages have unique names. So, in the Dutch layer, I am trying to redirect:

.nl/Artikelen.aspx

to

.com/Articles.aspx

In .nl/Artikelen.aspx I assigned a short cut to Articles in the .com layer. When rendered, the page tries to redirect to .nl/Articles.aspx instead of .com/Articles.aspx.

Does that make sense?

Imar
 
Nicolai Høeg Pedersen
Reply
Ah - yes. That makes sense.

When clicking the link you would then get a 301 redirect to .com/articles.aspx ?

That is how it works. If you are looking for the link to be parsed on .nl with the .com domain added - that would be a new 'feature' that needs to be implemented.
 
Reply
No, when I click the link, I get a 301 redirect to .nl/Articles.aspx, while I need .com/Articles.aspx instead.

.nl/Articles.aspx then results in a 404....

Imar
 
Reply
Hi Imar,

We have a similar issue with some clients, so until the new language module comes out, we created a JS function that get's the current page's sort page, then get the destination area's correspondent FriendlyHref and redirects. Your current domain settings should fo the rest with the .com and .nl

Notes
 - It uses jquery to help process the xml result from getnavigationxml.aspx feature from Dynamicweb
 - All page struture must be exactly the same.
 - Pages that do not "Show in menu" will not be able to change. In that case we sent the user to the areaId's start page
 - Since it has to get and process 2 xml streams, it might take a second or two to redirect.

If this helps and you want an example file, let me know.

Best Regards,
Nuno
 
Reply
Hi Nuno,

Thanks for your message and offer; yes, would love to see a solution for situatons where this may come in handly. Looks like you found a solution to "shadow" one langauge layer to another?

In my case, however, things are way simpler. I don't need the links to be context aware or in the same location in the tree. I just want to link two arbitrary pages in two different language layers. All I want to do is link from:

.nl/SomeRandomPage.aspx

to

.com/SomePath/SomFolder/SomeCompletelyUnrelatedPage.aspx

I could fix it by hard coding the link to the .com domain, but want to use the redirect functionality to make the links easier to change and show up in the menu's XML. So all I want is a link to another language layer that takes that layer's primary domain into account. Currently, when I redirect to a page in another layer, I get the correct page name, but on an incorrect domain. E.g.:

.nl/SomePath/SomFolder/SomeCompletelyUnrelatedPage.aspx

I just need DW to take the target top level domain name into account, not the source top level domain name.


Imar
 
Reply
Hi Imar,

unfortunately I have no solution for this. Let's just hope the guys at Dynamicweb implement it. To me makes sense, since the page belongs to a specific language/area.

I'll e-mail you the code for language redirection

Best Regards,
Nuno
 
Reply
Exactly; it makes sense to me as well ;-)

Thanks for the e-mail; will check out what you sent me.

Regards,

Imar
 
Nicolai Høeg Pedersen
Reply
The redirect will not work because you have “Ensure unique paths for each area” checked in url setup…
 
What that means is, that if you on 2 areas have 2 pages called the same, i.e. home, instead of calling one home.aspx and the other home1.aspx, both will be called home.aspx – basically giving two entries in the look up table with the same key. Then domain name is used to figure out which entry you want. When you link to .nl/ENArticles.aspx then, lookup will only happen in urls for .nl domain – and no articles.aspx is found in there giving the 404. Har to understand.
 
Basically that checkbox gives 1 url lookup table per area instead of 1 for the entire solution.
 
Disabling this checkbox will make the redirect work, but give you issues with i.e. your pages called home.aspx
 
I’ve created a bug for this…
 
Michael Fløe Haug
Reply
Hi Nuno

I would love to see your solution. Many of my sites could use the linking between similar pages on different language layers!

BTW I use DW Prof with the language feature on websites, so the language layers are similar in structure.

Best Regards,
Michael

 
Nuno Aguiar
Reply
Hi Michael,

In attachment you find a javascript file with two functions.

All you need to do is call the function getPageLanguage with the current page id (global page id tag) and the destination areaID (hardcoded or translate tag)

It's using jQuery.

Best Regards,
Nuno

 

You must be logged in to post in the forum