November Happy Hour will be moved to Thursday December 5th.

Best property type for internal page links?

Vote:
 

Hi everyone

Quick bit of advice which I'm sure will be an easy one for you all.

We've been using Property Type -> 'URL to page/external addres' to link href's on pages to other pages within our EPiSERVER site, however now have the interesting challenge where these links are being rendered without the /en/ or other country information in the URLs.

Rather than writing our own custom function to grab the Properties as Pages (say by setting them as Type 'Page') is there a _recommended_ way/Property Type to use that keeps true to the current language by default?

Sure it's obvious but not so far to us! Alex

#39000
Apr 27, 2010 19:07
Vote:
 

.. and to give a couple of examples:

Using

<%# CurrentPage.Property["OurOtherPageLink"] %>

produces a nice SEO friendly URL but with no Globalisation and

Using

<EPiServer:Property ID="OurOtherPageLink1" PropertyName="OurOtherPageLink" runat="server" />

products an internal looking URL with the .aspx on the end and the page ID as a get parameter.

What we'd like to get is as the first one, with a nice SEO friendly URL, but also include the Globalisation information :-)

#39001
Apr 27, 2010 19:25
Vote:
 

Use the Page property type for this.

#39002
Apr 27, 2010 21:31
Vote:
 

Thanks Frederik - so should have had you come and help us out with this job :-)

Do you have an example to share?

Alex

#39004
Apr 27, 2010 22:03
Vote:
 

Hehe, seems you're doing alright by yourself :).

Simply use the EPiServer property control to render the url.


<EPiServer:Property runat="server" PropertyName="MyPageProperty" />

You can also use it in your code-behind.

var myPageReference = (PageReference)CurrentPage["MyPageProperty"];

var myPage = GetPage(myPageReference);

myPage.LinkURL gives you the url.

Hope this helps.

Frederik

#39005
Apr 27, 2010 22:13
Vote:
 

We're learning fast :-) [largely thanks to your great blog posts :->]

As you couldn't make this gig, drinks on me in London next time you are over :-) :-)

Alex

#39006
Apr 27, 2010 22:36
Vote:
 

Haha, I'll take you up on that one! :)

Frederik

#39007
Apr 27, 2010 23:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.