Browse files

First draft of the README is done

  • Loading branch information...
matthewrobertson committed Jan 31, 2013
1 parent 9ea00a3 commit 335c4d40dc6246fdd6b5f4806ed240e43af61365
Showing with 21 additions and 17 deletions.
  1. +21 −17
@@ -83,28 +83,32 @@ Run the generator:
## Usage
-### Version override
+### Adding Alternate Versions
+Alternate versions of an application are registered using the `#add_alternate` method in the
+`ress.rb` initializer that is generated by the `ress:install` generator. The configurabe options
+available are all documented in the [comments of that file](
-You can manually override the detector and load a particular version of
-the site by passing in the `device` GET parameter with the ID of the
-version you'd like to load. This will look up the `link` tag based on
-the specified ID and load that version. For example, if you are on
-desktop but want the tablet version, visiting
-`` will redirect to the tablet version at
+### Version override
-Relatedly, you can prevent redirection completely, by specifying the
-`force=1` GET parameter. For example, if you are on desktop and know the
-URL of the tablet site, you can load ``.
+You can manually override the version detector javascript and allow mobile
+clients to visit the canonical version of the app by passing in a the GET
+url parameter `force_canonical=1`. This sets a session cookie in a `before_filter`
+that stops the version detection scipt from redirecting users so it only has to be
+done once per session. Ress includes a helper / controller method `force_canonical` that returns
+a link back to the canonical version of the current page with this query param appended.
+For, example you may include something like this in your `<footer>` to let mobile users
+access the canonical site.
-<!-- Include a way to manually switch between device types -->
+<!-- Let mobile devices access the canonical site -->
- <ul>
- <li><a href="?device=desktop">Desktop</a></li>
- <li><a href="?device=tablet">Tablet</a></li>
- <li><a href="?device=phone">Phone</a></li>
- </ul>
+ <% unless canonical_request? %>
+ <div>
+ You are currently viewing the mobile version of this site.
+ <%= link_to 'View the desktop version', force_canonical_url %>
+ </div>
+ <% end %>

0 comments on commit 335c4d4

Please sign in to comment.