The Content

Static >> The Content

The Basics

The site’s copy, or the content of each page, go into a folder called contents/ where each page has a file called file_name.copy. Copy files are yaml files of arbitrary hashes. There are two reserved keys: title and stylesheets. Those aside, you are free to add keys as you choose, allowing a page to be broken up into as many arbitrary sections as is chosen.

Default Page Copy

  title: Page Name
  contents: |
    here are some *contents* for the time being! <[link_to :page_name]>

Where ‘Page Name’ is the page’s name in the site map .

Formatting

The copy is simply a yaml file, so the file’s formatting is simple yet flexible (learn more about yaml). The most frequently used yaml idiom in static is the : | followed by a series of indented lines (as can be seen after contents above) which indicates a block of text is to follow. No quotes are required and line breaks are allowed. The block of text ends when a line is not indented.

Page Sections

Although the contents: key is included (and reference in the blueprint) by default, other keys may be added at any time. In this way it is possible to define different sections of your pages for finer-grained page layout. This is helpful if a single element is not enough to encompasse the whole of your page’s content (hint: often it isn’t).

Example Copy File

  title: Page Name
  contents: |
    here are some *contents* for the time being! 
  section: |
    here is a whole nother section!

Adding Stylesheets

Certain pages might need stylesheets that are not required by every page in the site. To accomodate this stylsheets may be specified in the page’s copy

Adding Stylesheets

  title: Page Name
  stylesheets:
    - first_sheet
    - second_sheet
  contents: |
    here are some *contents* for the time being! <[link_to :page_name]>

Textile in the Copy

While it is not required that you process every section of your content with textile it is encouraged where you might be inclined to do simple in-copy formatting. Using textile to display the content section will be further discussed in the blueprint.

In-Content Processing

Linking and some other goodies, such as breadcrumbs, are available to the copy for processing. <[ ]> are used to surround code which is then eval’d under the xhtml module being used by rbml.

Methods for Processing

link_to :page_name, ‘optional link text’
creates an anchor tag for the page called page_name as described in the site map. If no optional link text is provided the name given in the site map will be used.
image ‘file_name.ext’, ‘alt text’
creates an img tag with the optional alternate text.
resource_address ‘file_name.ext’
Returns the full address of the file requested from base/resources/. Useful for resources other aside from images. Or images, if you would like to make your own img tag for whatever reason.
script_address ‘file_name.ext’
Returrns the full address of the file requested from the base/script/ directory. Use it how you like. PHP includes and JavaScript files come to mind.
breadcrumbs
Gives the absolute path to the current page as related to the site map. Currently breadcrumbs works such that top-level links return a blank string while any others link to parent pages, but show the current page as plain text. This should typically be used in the blueprint but can also be used in the copy. Seperates elements with a ‘>>’ by default, but this may be changed with an optional argument (e.g. breadcrumbs(’, ‘)).