It makes perfect sense that the "meat" of a page would be stored in another file, but what about those little bits of text that appear across the rest of the page? Titles, metadata, perhaps filenames—anything that only changes slightly from page to page, but you can't justify it in an input page.
That's where attributes come in. Attributes are strings of text you can give a value in the input page, and where its corresponding token in the template appears, Apricot will substitute that value instead.
[#] Using Attributes
Attributes are defined in the template by an attribute token. Say we have a need for putting animal names in a page. You can start by placing a token inline with your markup wherever you need the attribute value to appear.
<p>Let's talk about [#animal#]. I <em>love</em> [#animal#].</p>
On the other half of the equation, each input page begins with a set of HTML comments called attribute declarations, where the value of those attributes is defined. This can be any text that would go in an HTML document, including filenames. All input pages have at least one of these lines, where you define the
template that the page will use.
Let's declare that
animal attribute for this page:
<!-- attrib animal: lynxes -->
Now, if we were to build this page, the resulting HTML would look like this:
<p>Let's talk about lynxes. I <em>love</em> lynxes.</p>
Be careful with any symbols or punctuation you include in attribute declarations, like colons or quotation marks. AutoSite will either stumble on these or literally insert them into your page, which could escape HTML attributes in your template early. Use a symbol code when in doubt.
[#] The Attribute Map
One of the two tabs in AutoSite's Build Information Panel is the Attribute Map. Much like the Sitemap, the Attribute Map is a tree view that lets you view all the attributes for your project, which pages use them, and what values those pages have their attributes set to.
To populate the Attribute Map, build your site. The tree view will then appear in the "Attribute Map" tab of the lower left of the GUI. (If you make any further changes, building again will update the Attribute Map.)
From here, you can click through to see which pages have specific attributes defined for them and what they're set to. This makes it especially easy to catch any errors you might've made in defining them.
One final note about the Attribute Map's functionality: you can drag any attribute out of the tree view and into the Code Editor, and AutoSite will place a token for it at that point in the text.
[#] Special Attributes
AutoSite features a few attributes for very specific, functional purposes. Most are defined automatically based on certain information about the page, or are used by Apricot in the build process.
||Apricot inserts the contents of the input page into the template at the
||The last modified date of the input page, regardless of build date or when the template was last updated. The date output will be in the MM/DD/YYYY format.|
||The relative path of the input page from root. This is especially useful with conditionals for rendering certain text or markup based on which page is being processed.|
||The relative path to root from the input page. Useful for links to site assets and other pages.|
||This is the template Apricot will insert the input page's contents into. If you don't set this on an input page, Apricot will use the