The <navlinks> Tag
A common site structure strategy is to provide Back, Forward and
Up links between pages. This is especially frequent in papers or
manuals, and (as you can see above) is used in this documentation.
WebMake supports this using the <navlinks> tag.
To use this, first define a sitemap. This tells WebMake how to order the page
hierarchy, and which pages to include.
Next, define 3 templates, one for previous, one for next and one
for up links. These should contain references to ${url}
(note: not $(url)), which will be replaced with the URL for
the next, previous, or parent content item, whichever is applicable for the
direction in question.
Also, references to ${name} will be expanded to the name of the
content item in that direction, allowing you to retrieve metadata for that
content like so: $[${name}.title] .
You can also add templates to be used when there is no previous,
next or up content item; for example, the "top" page of a site has
no up content item. These are strictly optional though.
Then add a <navlinks> tag to the WebMake file as follows.
<navlinks name=mynavlinks map=sitemapname
up=uptemplatename
next=nexttemplatename
prev=prevtemplatename
noup=nouptemplatename
nonext=nonexttemplatename
noprev=noprevtemplatename>
content text
</navlinks>
The content text acts just like a normal content item, but references to
${nexttext}, ${prevtext} or ${uptext}
will be replaced with the appropriate template; e.g. ${uptext}
will be replaced by either ${uptemplatename} or
${nouptemplatename} depending on if this is the top page or
not.
You can then add references to $[mynavlinks] in
other content items, and the navigation links will be inserted.
Note: navlinks content items must be included as a deferred
reference!
Attribute Reference
These are the attributes accepted by the <navlinks> tag.
-
name
-
the name of the navigation-links content item.
Required.
-
map
-
the name of the sitemap used to determine page
ordering. Required.
-
up
-
the name of the template used to draw Up
links. Required.
-
next
-
the name of the template used to draw Next
links. Required.
-
prev
-
the name of the template used to draw Prev
links. Required.
-
noup
-
the name of the template used when there is
no Up link, ie. for the page at the top level of the
site. Optional -- the default is an empty string.
-
nonext
-
the name of the template used when there is
no Next link, ie. the last page in the site.
Optional -- the default is an empty string.
-
noprev
-
the name of the template used when there is
no Prev link, ie. for the first page in the site.
Optional -- the default is an empty string.
Example
This will generate an extremely simple set of <a href> links, no frills.
The sitemap it uses isn't detailed here; see the sitemap documentation for details on how to make a site map.
<template name=up><a href=${url}>Up</a></template>
<template name=next><a href=${url}>Next</a></template>
<template name=prev><a href=${url}>Prev</a></template>
<navlinks name=name map=sitemapname up=up next=next prev=prev>
${prevtext} | ${uptext} | ${nexttext}
</navlinks>
|