Skip to content

Article Order

Andrea Campi edited this page Oct 17, 2012 · 9 revisions

Article Order

You can tell Treesaver to check another file for order of articles by creating a link element with a rel value of contents:

  <link rel="contents" href="toc.json" />

Treesaver will download this file, which must contain a valid JSON document. The article order is specified by a contents key whose value must be an Array of Objects; Treesaver will traverse it to find each document and its URL, and add them to the publication in the order they appear in the array.

For example, the document below:

{
  "contents": [
    {
      "url": "toc.html",
      "hidden": true
    },
    {
      "url": "article-1.html",
      "title": "Article One",
      "thumb": "openroad-thumb.jpg",
      "byline": "John Doe"
    },
    {
      "url": "article-2.html",
      "title": "Article Two",
      "thumb": "river-thumb.jpg",
      "byline": "Jane Doe"
    }
  ]
}

would produce the following article order:

  1. toc.html
  2. article-1.html
  3. article-2.html

Properties

Treesaver reserves some properties for its own use, but you are free to add more for your own use, both for template variables replacement and for use by JavaScript event listeners.

In the example above, thumb and byline are custom properties; Treesaver will store them unmodified.

Top-level Property Names

Some keys have pre-defined semantics when used at the top level of the JSON document:

  • contents: Specifies the order of documents within the whole publication.
  • settings: Publication-wide settings (advanced topic).

No other property names have special semantics at this time.

Article Property Names

Some keys have pre-defined semantics when specified on an article:

  • url: URL to the article document.
  • title: Used for the title of the window when viewing the article.
  • contents: Specifies the order of documents nested under the current document, if any. See the nested-articles example for more information.

No other property names have special semantics at this time.

Clone this wiki locally