Skip to content

0.9.x Article Order

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

Article Order

This page is based on Treesaver 0.9.x. See the Article Order page for current documentation.

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.html" />

Treesaver will download this file and look for HTML5 microdata items with the url property. For example, the markup below:

  <div itemscope data-properties="self">
    <h1 itemprop="title">
      <a href="toc.html" itemprop="url">The Daily Gazette</a>
    </h1>
  </div>

  <div itemscope>
    <h3 itemprop="title"><a href="article-1.html" itemprop="url">First Article</a></h3>
    <p itemprop="byline">By John Johnson</p>
  </div>

  <div itemscope>
    <h3 itemprop="title"><a href="article-2.html" itemprop="url">Second Article</a></h3>
    <p itemprop="byline">By Jane Jackson</p>
  </div>

Each article is contained within an element with the itemscope attribute. Treesaver searches for an <a> element with itemprop=url within each item.

The order of the articles is the same as the markup order. For example, the markup fragment above would produce the following article order:

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

data-properties flags

The data-properties attribute on an item (set on the element with the itemscope attribute) can be used set two special behaviors:

  • self: Signifies that the item is the entry for the TOC file itself. This is useful for avoiding URL mismatches (such as / and /index.html)
  • hidden: Places the item in the article order, but excludes it from any Chrome binding (i.e. prevents it from displaying in a sidebar table of contents)

Special Property Names

There are two itemprop names with special semantics in the table of contents:

  • url: The position of the file within the order of articles
  • title: Used for the title of the window when viewing the article

No other property names have special semantics at this time.

Using the Current File as Table of Contents

When the current page also serves as the table of contents, the additional rel value of self should be added to the link element:

  <link rel="contents self" href="toc.html" />

This tells Treesaver to use the current URL as the table of contents, and helps protect against URL mismatches (such as dogs/ and dogs/index.html).

Clone this wiki locally