我们已经在我们的网站上实现了51degrees.mobi,该网站正在使用Umbraco。在web.config中,我们添加了主页重定向,它正确地重定向到我们的主页模板。
Umbraco允许您为doctype创建备用模板,这样我们就可以重定向到mysite.com?alttemplate=mobile-home
问题是,我们不会重定向到m.mysite.com站点。我们只是想使用和替代模板。来自51degrees.mobi的默认重定向如下:
<redirect firstRequestOnly="true" mobileHomePageUrl="~/mobile-home" timeout="20" devicesFile="~/App_Data/Devices.dat" mobilePagesRegex="/mobile" //Don't quite understand the 'mobilePagesRegex'> </redirect>
其他一些文档建议将此内容添加到重定向
<locations> <location name="default" url="http://mysite.com?alttemplate=mobile"> <add property="url" matchExpression="http://mysite.com"/> <add property="IsMobileDevice" matchExpression="true"/> </location>
<location name="thetest" url="~/{0}?alttemplate=mobile" matchExpression="(?<=^\w+://.+/).+" > <add property="IsMobileDevice" matchExpression="true"/> </location> </locations>
问题是,我们为内部页面的不同布局设置了多个不同的移动模板。3-4个不同的模板。
移动端-内部、移动端列表、移动端详细信息页面
我们我需要知道如何让51度知道如何使用替代模板,当页面是一个特定的文档类型。我希望这是有意义的。如果有人用Umbraco做到了这一点,那就太好了。谢谢。
发布于 2011-04-29 11:25:55
如果你使用51Degrees,你可以根据Request对象在MVC中调整你的路由。51Degrees向browser对象添加了一些很好的属性,特别是bool Request.Browser.IsMobileDevice。如果你需要进一步的方向,我在here上写了一篇博文,但我认为会满足你的需要。
https://stackoverflow.com/questions/4938490
复制相似问题