User Manual

Pages

Pages provide the link between what a visitor to your site enters into the location bar and what Interface sends back to be displayed in the browser window. When a request comes in, the URL is parsed into segments and then matched against the path for each Page one by one until a successful match is made. Once a successful match is made, the template associated with that Page will be rendered and displayed in the browser.

Slugs

The Slug is each Page’s unique identifier and the string in the URL that is matched when resolving incoming requests. Since Pages can be nested in a hierarchy, each Page inherits its path from the entire lineage of Pages leading up to it. A forward slash (/) is automatically generated to separate a Slug from a parent Slug, but you can add as many forward slashes into the Slug as you’d like otherwise. Slugs have a very limited set of characters they can be composed of (chiefly alphanumerics, dashes, colons and periods), but don’t worry about remembering them; if you try to use a character that is not allowed, it will be substituted or removed for you. These limitations are necessary in order to be compliant with general HTTP conventions and are not meant to hinder your slug-naming creativity.

Variable Slugs

In order to provide some flexibility in your routing, Interface offers variable Slugs. You can specify a Slug as variable by appending its name with a colon (:). If a Slug is variable, when that Page’s path is being matched against incoming requests, that part of the path will match any value and then provide the value of the matched segment for use in the Templates. For example, if your path is /photo/galleries/:gallery/, that Page will match /photo/galleries/mexico/ or /photo/galleries/moon-landing/, which allows for a variable “gallery” in the Template set to the corresponding segment, in this case “mexico” or “moon-landing”. This variable can later be used to pull down content specific to that particular gallery and enables you to have as many gallery pages as you want without having to create a new Page for each one.

Keep in mind: Any Pages with variable paths must come after Pages with non-variable paths if the non-variable Page is still going to be found, since the variable slug in its openness will mask any request to the static slug. Using the above case, if you have a /photo/galleries/about/, the “About” Page must come before the variable slug or the “/about” will match :gallery and become just another parameter to the gallery template.

Templates

Templates are used to render content to be displayed in the browser (displaying your Web designs). Templates are written in ERB, a very succinct yet powerful templating language based on Ruby. There are many references to ERB around the Web, but the Interface User Manual covers the extensions made by Interface that enable you to interact simply and painlessly with the content in the CMS. Templates are not managed by Interface, but rather are uploaded by FTP to our servers in order to enable you to edit templates in whatever editor you desire. Because the choice of editor can be a temperamental and borderline religious decision for most developers, we decided not to try to implement an in-browser compromise, sure to be lacking your favorite features, and instead allow you to write Templates however you choose and then upload them to our servers.

Nesting and Reorganizing

Pages are inherently nestable. Every Page generates a path based on its Slug and the Slugs of all the Pages it inherits from. There are two ways to make a Page a child of another Page. The first is to create it from the Page list (in the middle column) with the ‘+’ icon. Once created, this Page will accept its place below the Page it was created from. The other way is to order and nest all of the Pages at once under the “Reorganize Pages” link. While dragging a Page around the hierarchy, it will snap into position underneath other Pages, or as a root Page with no parent. Reorganizing in this way makes no definite changes until you press the “Save” button, so you are free to experiment before committing to a new ordering.

Errors (404 and 500)

In order to have custom 404 and 500 pages, place a template in the root of the templates directory named after the errors (404.html.erb and 500.html.erb respectively). These are templates just like any other, but keep in mind when coding the 404 page that when a 404 page renders no pages will have matched, so no variable slugs have been assigned and these variables will not be available in your template.