Developer forum

Forum » Feature requests » Item link to output pagename?

Item link to output pagename?

Rune Skovbo
Reply

Hi there

When I use the item type "link", the value i get is something like: Default.aspx?id=15

It would be nice if it also gave me the option to output the pagename, instead of the ID. This would eleminate the need for a 301 redirect each time.

Regards,
Rune


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there

That's only the internal link; it should be rewritten to the friendly name on output. Is that not what you're seeing?

Imar

 
Rune Skovbo
Reply

Actually I see it the other way around.

In my item I see the pagename ie. "Downloads", but the HTML output renders it as default.aspx?id=15

When I click the link i get 301 redirected to "Downloads".

/Rune

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hmmm, that doesn't sound right. Could this be a bug?

 
Rune Skovbo
Reply

Could be. Im on: Professional 2014 version 8.6.1.11

But I could see the value of being able to choose between an ID and a pagename.

 
Nicolai Høeg Pedersen
Reply

Hi Rune

If you output your link to <a href="Default.aspx?ID=123"> Dynamicweb will rewrite the output to /Download before the page is sent. That is a configuration in MC->Urls section.

If you do something like <scritp>var link = "Default.aspx?ID=123";</script> and use that somehow, Dynamicweb will do a redirect. You can change this hacky by reading the link from an a-tag using a JS dom selector.

If your template is Razor, you can use Dynamicweb.Frontend.SearchFriendlyUrls.GetFriendlyUrl(link)