Developer forum

Forum » CMS - Standard features » Output replacement for friendly URLs

Output replacement for friendly URLs

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I noticed in a few sites of ours that friendly URLs aren't generated for hrefs that set up with single quotes. In other words, this:

@{
  string url = item.GetString("ItemPublisher:Item.DetailsUrl.PID");
  <a href='@url'>Click</a>
}

ends up as something like href='Default.aspx?ID=123'

whereas this:

@{
  string url = item.GetString("ItemPublisher:Item.DetailsUrl.PID");
  <a href="@url">Click</a>
}

leads to this: href="friendly/name/of/page"

Is this by design or should this work? Sometimes it's easier to work with the single quotes in Razor scenarios. (I do realize that we can work around it using \" in Razor; it's just something that developers don't always seem to do).

Thanks,

Imar


Replies

 
Nicolai Høeg Pedersen
Reply

By design - single quotes are not supported, and I do not feel like change it...

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Got it, that's good to know.

Thanks,

Imar

 

 
Lars Larsen
Lars Larsen
Reply

Hi

If a link is like "default.aspx?id=1234" it is not translated into a userfriendly url. Only if the letter "d" in "default" is in uppercase! Couldn't you Nicolai change this to be case insensitive?

Tested on DW9.1.4

 

You must be logged in to post in the forum