Reputation: 383
This project is using Sitecore.NET 7.2 .NET Framework 4.0.30319.34209
So I have two main questions I need guidance on.
1 We want to display a page specifically for mobile and not for the desktop app. Is this possible?...
I've searched the web and Sitecore documentation but all I could find is information about responsive design. I don't quite understand why they don't want to display the page on desktop, but I'm only a developer so my questions are irrelevant. Haha. Anyways, right now, we have two different environments (as many companies do): QA and Production.
Currently our production page looks correct, however our QA page (that looks exactly like our production page), does not show up. I've tried republishing the page and it still doesn't resolve the issue. I thought maybe it was an issue with the server, but they claim it is not.
2) Any ideas why a page would show up in Production and not QA if the environment is the same, and the actual page content is the same?...
I'm still learning the actual structure of Sitecore and how everything works so any help, tips and guidance would be greatly appreciated!
Upvotes: 0
Views: 153
Reputation: 383
So I was actually able to figure out both questions. So here goes my explanation for anyone else that runs into this problem and hopefully it'll help.
First off, this question is specifically for rendering on a mobile app. Not necessarily for mobile web. There was an instance where we didn't necessarily want to display the mobile app content on mobile web or PC. I didn't do a good job stating that when I first asked the question so wanted to clear that up now.
QUESTION: We want to display a page specifically for mobile and not for the desktop app. Is this possible?...
ANSWER: Adding on to Richard's answer, having a mobile detection function was the solution that I utilized. I created a Show on desktop/Show on Mobile Web and if neither were checked, it would display on the mobile app. You can read the documentation from Sitecore for specific details or you can check out some of the resources I found below.
Here's a good resource for mobile detection, also this article by Brian Pederson and this article from Sitecore.net might be helpful. Depending on the version of sitecore you have, you can also check out this article. If you have issues this article might be helpful.
For those of you using an existing Sitecore CMS, I would recommend checking to see if there are any "mobile only" or "desktop only" options already in place. If you aren't sure, ask one of your developers.
QUESTION: Any ideas why a page would show up in Production and not QA if the environment is the same, and the actual page content is the same?...
ANSWER: This actually was my own error. I didn't check to see if the page was disabled and if the display options were checked/unchecked. I didn't create this project originally so I didn't know that there would be pages that would be disabled. They don't have their QA environment mirroring production. It's quite strange if I do say so myself. Haha.
Hopefully, this information helps someone out there that's just starting with Sitecore and saves you some time looking for references.
Upvotes: 1
Reputation: 4266
There are many answers to question 1. It will really be dependent on how you are detecting desktop vs mobile.
A simple solution would be to create a custom ItemResolver
and detect the client device from the Request
object. Have a field on your page template, something like Hide from Desktop
, or a cleaner solution might be to have a MultiList
field with device types to hide this page for.
Then in the ItemResolver
"detect" the users device and compare that to the item you are trying to load. If it is "hidden" from the device you can return a 404 from there.
You would also need to modify any code that creates navigation so that links are not created on the mobile version of menu's. This would also affect any output caching that you have set on the Sitecore renderings/sublayouts.
Upvotes: 2