Wednesday, December 15, 2010

Adding a per-device layout in Sitecore

Sitecore lets you render an item differently for different devices (i.e. rss, mobile, etc.). Once you've developed the layout, here are the steps for moving it to acceptance or production:
  1. Create a new layout of the same name via the Content Editor.
  2. Overwrite the aspx file generated in step 1 with your layout. Copy over aspx.cs and designer files too.
  3. Copy other files (fresh dll's, css's, images, and so on).
  4. Create the device via the Content Editor. Usually specify a query string (device=mobile). Save!!
  5. Associate item template, device, and layout via Content Editor: templates -> UserDefined -> Item Template -> Std Values -> Presentation ->Details -> Edit Device -> select layout. Save!!
  6. Do a sitewide smart publish.
  7. Enjoy! (after waiting out the cache, that is)
Developing the layout in the first place is quite similar ...

No comments:

Post a Comment