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

Url link with parameters

Vote:
 

Hi,

Is it possible to make an Url link within site with request parameters? For example http://mysite.com/search?q=foobar.

I think this was possible in EPi 7 by using the external link but EPi 7.5 seems to convert external links to page links and the conversion process loses possible parameters.

#87065
Jun 09, 2014 14:56
Vote:
 

Hi,

The paramters will be saved. But if you're editing the link, they will be deleted if you're not re-adding them again.

This goes for all link tools in EPiServer. Would be nice with an extra field for querystrings...

#87091
Jun 09, 2014 17:47
Vote:
 

Hi Johan,

Thank you for your response. I'll have to dig this a little bit deeper. There might be something wrong in my own code then.

#87107
Edited, Jun 10, 2014 9:31
Vote:
 

I have this same problem, but my site consists of a lot of one-pagers where the user navigate using hashtags, in this case I want the user to link to an internal page with a hashtag-argument, but everything after the hash is stripped. Could the link-tool somehow be extended to not strip the hash?

#113504
Nov 22, 2014 14:08
Vote:
 

@dagstuan, we have similiar issue and I have reported it as a bug (doesn't seem to show up in the bug list).

Anyways I'm assuming you are here talking about the XhtmlString property (TinyMCE editor).

Step one, there is the original LInk tool button for TinyMCE that you can add to the editor toolbar (in admin mode change what buttons are in the toolbar or use the new feature to do it from code).

With that link button you can add any kind of link manually (if you use the filefolder icon in the popup it only allows to select images etc content) by entering the value to the field -> also preserves anchor link values when re-opening the editor.

Next step is to override the XhtmlString rendering

  • add a display template for the XhtmlString (/Views/Shared/DisplayTemplates/XhtmlString.cshtml)
    • you can look at the original display template in the: EPiServer.Cms.Shell.UI.zip (extract, Util\Views\Shared\DisplayTemplates\XhtmlString.ascx)
    • you need to do a custom implementation of the RenderXhtmlString extension method
      • bascially copy EPiServer code and in your implementation add the fragment to the url
    • use ILSpy for example to see the original implementation, the issue is with the original implementation if the page is resolved to EPiServer page the url fragment is not added (see EPiServer.Web.Mvc.Html.XhtmlStringExtensions EPiServer.dll, the issue method is the private RenderFragment method calling urlresolver.GetShortCutAwareUrl which doesn't add the url fragment to the produced url)
#113505
Nov 23, 2014 11:11
Vote:
 

Using EPiServer 7.14 we've found this is a problem triggered by links by a the pattern of something like "?id=12345". Our workaround was to replace the links with something like "?foo=bar&id=12345". Somewhat ugly, but works.

#116210
Jan 26, 2015 15:37
huseyinerdinc - Mar 27, 2023 10:20
Greetings from 2023. We have seen this problem on v11.17.0 and our solution was to change "id" to something else.
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.