I want to use a sub domain for the mobile version of the site im making
so for example it will be m.mysite.com for the www.mysite.com
can i just copy everything from the desktop site to the mobile site then change the template to mobile template?
so that it will actually have the same url except the subdomain like
m.mysite.com/about with www.mysite.com/about and if I add content to the main site will it shows in the mobile site given that the database it use will be the same one.
You can use the same site and the same content for both sites, but you have to implement some logic that will define what template to use for the current client.
Here is another screen shot of a site where I have done exactly this. As you can see I have a load of different homepages all with different domains pointing to each.
but this will make the admin have to create a separate content for the mobile site while my mobile site will have exact same content with the desktop site.
It only need a different template because the position and design of the page will be significantly different between the 2.
This is exactly what I recommended you, you have to set mobile and desktop domains to the same root node and add custom logic that will handle which template to choose for the current request.
So from what I understand here and the link given,
The mobileViewName is the template name.
We need to create a controller for each of the document type.
Is there no way to redirect all document type to the mobile version instead of making a controller for each one?
public class HomeController : RenderMvcController
{
public override ActionResult Index(RenderModel model)
{
//Do some stuff here, then return the base method
if (Request.Browser.IsMobileDevice)
{
return View("mobileViewName");
}
return base.Index(model);
}
}
sub domain for mobile site
I want to use a sub domain for the mobile version of the site im making
so for example it will be m.mysite.com for the www.mysite.com can i just copy everything from the desktop site to the mobile site then change the template to mobile template?
so that it will actually have the same url except the subdomain like m.mysite.com/about with www.mysite.com/about and if I add content to the main site will it shows in the mobile site given that the database it use will be the same one.
Hi Philip
You can use the same site and the same content for both sites, but you have to implement some logic that will define what template to use for the current client.
Look at this code: https://gist.github.com/brendankowitz/4071660
You need something like that, define what devices is visiting your page and use the needed template.
Thanks,
Alex
Where and how do I implement that?
Hi Phillip,
If you have multiple sites (multiple homepages) you need to set a domain for each homepage.
This can easily be done by right clicking on each homepage node and then clicking on Culture & Hostnames.
Do this for both and create which ever domain you want to link to each homepage node.
so
www.mysite.com - points to homepage1 m.mysite.com - points to homepage2
Here is another screen shot of a site where I have done exactly this. As you can see I have a load of different homepages all with different domains pointing to each.
but this will make the admin have to create a separate content for the mobile site while my mobile site will have exact same content with the desktop site.
It only need a different template because the position and design of the page will be significantly different between the 2.
Hi Philip
This is exactly what I recommended you, you have to set mobile and desktop domains to the same root node and add custom logic that will handle which template to choose for the current request.
Thanks,
Alex
i have no idea on how to add the custom logic or where
Philip, try to create custom render controller, something like that:
Read more about render controllers - https://our.umbraco.org/documentation/implementation/Controllers/
So from what I understand here and the link given,
The mobileViewName is the template name.
We need to create a controller for each of the document type.
Is there no way to redirect all document type to the mobile version instead of making a controller for each one?
currently starting to build the mobile template now but i got
cannot perform runtime binding on a null reference
on the line
any help on how i can use currentpage again?
You can create controller for base document type, it will be for all doctypes nested from this one or another way is to use SetDefaultControllerType-
is working on a reply...