The URL to the “static” images list contains the Id of the page with gallery, for example /gallery?id=111. The HTML body of the gallery page is just the <ul> list with all images rendered as <img> tags.
Rewriting internal links
When I started to test the solution I noticed that the static link was always rewritten into another URL, because EPiServer recognized that link as internal address. I tried to use absolute URL like http://www.mysite.com/gallery?id=111 but it didn’t help.
After researching about how to prevent EPiServer from rewriting href attribute I found out that the solution was to use combination of two attributes on the link level:
- The id attribute has to be assigned.
- The EpiNoRewrite attribute has to be used.
Now the static link looks like:
<a id='static-page' href='/gallery?id=111' EpiNoRewrite='true' >
<img src='images/img1' />
The EpiNoRewrite attribute is configurable. It is stored in UrlPreventRewriteAttrebute property of EPiServer.Configuration.Settings. When value is not assigned, then the ‘EpiNoRewrite’ is used as a default. The solution seems to be quick and simple, however EPiserver is giving the following advice :
“For internal use, do not use. Defines the HTML attribute name that is used by the CMS 5 legacy editor when writing / parsing content”
I didn’t found any other way how to prevent EPiServer from rewriting URL addresses. Please leave some comments if you have any better solution for this.