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

External Link to internal page

Vote:
 

I have a page to show products based on a custom route. The route would look like host/product/[category]/[productnumber].

In order to hyperlink from an epi page tineeditor to a product one would make an external link pointing to www.mypage.se/product/mycategory/123. This works, though episerver changes the it to an internal link which look like it's linking to the productpage, it still links to the correct the category/product. Not very user-friendly since it isn't possible to see which product is linked to, but it works.

But, the next time anything in the tinyeditor is changed (even though no changes to the hyperlink itself) and published, the hyperlink is changed to an edit-mode link, like www.mypage.se/episerver/cms/content... etc - whcih of course isn't reachable for a user.

#180212
Jul 03, 2017 12:36
Vote:
 

I'm guessing this behaviour may stem from how your have developed your custom route.

Have you used added a partial routing class or have you just added your own entry to the route table? My guess is you've done the latter.

I think what is happening is that on publish of the page containing the XHTML field, episerver scans any links to see if they resolve to an Episerver piece of content. If they do Episerver assumes you'd want to manage those links (ie.a editors will be warned if they try to delete a piece of content to that has inbound links to it - this is a really good thing!), so it marks it as an internal link.

As episerver now sees this an an internal link to a specific bit of content, on next publish it will try to generate a friendly url for it. As it has no information about what that route should be for that specific content (the only logic is in the pattern in you've added to the routetable), the only match will be the route to edit mode so it will display that.

If you were to add your route as a partial route, then as part of that implementation you tell Episerver how to 

  1. Route to the content given a url
  2. Create a friendly url for a piece of content

I think if you added your custom routing using this method, you wouldn't see this behaviour.

DISCLAIMER : Most of this was an extreme guess so I may be well off base........laughing

#180218
Jul 03, 2017 14:09
Vote:
 

Thanks alot! I'll try that!

#180250
Jul 04, 2017 11:33
Vote:
 

I got the partialroute part working the way you describe but I'm not really sure how to implement the getpartialvirtualpath. I thought I got it right but links behave the same way still.

Anyway, I found a post on a similar problem with a workaround. If skipping the protocol when inserting external link, the link stays as an external link and the links stay functional.

//www.mypage.se/product/mycategory/123

instead of

http://www.mypage.se/product/mycategory/123

not a very satisfying solution but I couldn't make it work in another way.

#180305
Jul 05, 2017 15:15
* 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.