51degrees and Umbraco CMS
We have impl开发者_开发知识库emented 51degrees.mobi to our website that is using Umbraco CMS. In the web.config we added our homepage redirect and it correctly redirected to our homepage template.
Umbraco allows you to create alternate templates to doctypes so we are able to redirect to mysite.com?alttemplate=mobile-home
The thing is, we are not redirecting to an m.mysite.com site. We are just wanting to use and alternate template. The default redirect from the 51degrees.mobi is below:
<redirect firstRequestOnly="true"
mobileHomePageUrl="~/mobile-home"
timeout="20"
devicesFile="~/App_Data/Devices.dat"
mobilePagesRegex="/mobile" //Don't quite understand the 'mobilePagesRegex'>
</redirect>
Some other documentation says add this to the 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>
The thing is, we have multiple different mobile templates set up for different layouts of our internal pages. 3-4 different templates.
mobile-internal, mobile-listing, mobile-detailspage
We I need to know how to make 51degrees know to use the alternate template when the page is a specific doctype. I hope that makes sense. If anyone has done this with Umbraco that would be great. Thanks.
If you use 51Degrees you can adjust your routes in MVC based on the Request object. 51Degrees adds some nice properties to the browser object, specifically the bool [Request.Browser.IsMobileDevice]. I wrote a blog post on it here if you need further direction, but I think will suit your needs.
精彩评论