我有一个 html 片段,它包含在模板化 EPiServer 页面的属性中,在该 html 中有一个img
标签,其中有一个相对 url。
查看页面时,我可以看到标记的 src 属性已更改为具有 prefix /ProjectName/Templates/Pages/
。
我知道这样做是为了正确定位HtmlRewriteToExternal
与 aspx 模板(确实存在于其中Templates\Pages
)一起存储的图像文件,但是在我的情况下,旨在成为 html 片段一部分的图像实际上存储在PageFiles/nnn/
(其中 nnn 实际上是父页面的PageFolderID
),我需要以某种方式使更改后的 html 反映这一点。
我创建了一个继承FriendlyUrlRewriteProvider
并注册了我的类的类。我可以调试应用程序,并观察请求通过被覆盖的方法,但我仍然看不到前缀被添加到哪里,也不知道如何更改它。我可以在我的类中将 src 标记更改为不同的相对路径,但仍在添加前缀。
我已经阅读了我在 EPiServer url 重写中可以找到的所有内容,但找不到任何暗示该前缀被添加到何处或如何停止或更改它的任何内容。
我读过的东西:
- http://blogs.interakting.co.uk/post/File-Extensions-and-URL-Rewriting-in-EPiServer.aspx
- http://blog.fredrikhaglund.se/blog/2008/05/07/disable-episerver-urlrewriter-interference/(这可能包含我正在寻找的答案)
- http://labs.kaliko.com/2010/11/prevent-episerver-urlrewrite.html
- http://sourcecodebean.com/archives/episerver-friendly-urls-for-paginated-pages-and-why-the-asplinkbutton-must-die/510
- http://tedgustaf.com/en/blog/2008/7/create-a-custom-url-rewrite-provider-for-episerver/
- http://tedgustaf.com/en/blog/2011/4/publishing-plain-html-pages-in-episerver/
- http://sdk.episerver.com/library/cms5/Developers%20Guide/Friendly%20URL.htm
- http://sdk.episerver.com/library/cms6.1/html/T_EPiServer_Web_UrlRewriteModule.htm
- http://labs.episerver.com/en/Blogs/Ruwen/Dates/111218/112064/112154/
- http://world.episerver.com/Blogs/Magnus-Strale/Dates/2011/3/Do-we-really-need-yet-another-HTML-parser/
- http://world.episerver.com/Blogs/Yugeen-Klimenko/Dates/2011/6/How-EPiServer-URL-Rewriting-works/
- http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=46869
对于我实际想要实现的目标,我愿意接受完全不同的解决方案,如下所示:
我有多个独立的静态 html 文件集和相关的图像/css/js 文件,我正在尝试使用 EPiServer 存储/发布它们。每组的结构看起来像
- 设置文件夹/
- htmlfileA.html
- htmlfileB.html
- css/
- 样式.css
- 图片/
- piccy1.png
- piccy2.png
- js/
- 魔术.js
我想我应该为集合创建一个 EPiServer 页面,然后为每个 html 文件创建子页面,将文件中的 html 存储在子页面的属性中。目前我将相关的静态文件存储在相关 setfolder 页面的 PageFiles 中,因为这似乎是放置它们的逻辑上最一致的位置。