This plugin makes it possible to manage different versions of the same page, allowing to:
- make older/newer versions available;
- highlight the latest version.
On my personal website/blog, I publish articles which I sometimes update. Sometimes, I add a few lines of text with a
Updated on DATE. message; other times, I rewrite the whole article. In this latter case, I want:
- the main version of the article to be the latest one;
- oldest versions still to be available;
- the main list of my articles to list only the latest version of each article.
- They both contain the directive
[[!versionof parent]], marking them as a version of the main article (which happens to be their parent page).
- On the old article, links to the other articles (only one here) are available.
- On the page listing my articles, only the latest article appears.
- The main page lists all versions of this article, and redirects to the latest one.
Pages are marked as versions as other pages using tags (subtags of
[[!versionof ]] simply add the appropriate tag to the current page (thus, one can ignore this directive, but it makes things easier).
Pages can be marked as versions of another page (e.g.
foo/version2 are versions of page
foo), or versions of an arbitrary abstract page (called label later). There is no conflict between them (that is, pages marked as a version of page
foo and as a version of label
foo are not a version of the same page).
Marks current page as a version of another page. Its main forms are:
[[!versionof name=foo]]Mark current page as a version of page
foois searched using the same linking rules as a WikiLink).
[[!versionof label=bar]]Mark current page as a version of some abstract object labelled
It may be convenient to refer to some particular page. Thus, those alternative forms are also available:
[[!versionof name]]Mark current page as a version of itself.
[[!versionof parent]]Mark current page as a version of its parent page.
To add a list to the other versions of a page (both older and newer), a template is provided. It is called with:
[[!template id=otherversions version=VERSION template=INLINETEMPLATE]]
- (Required) Pages that are a version of
VERSIONare listed (for instance
[[!template id=otherversions version=name=foo]]).
- (Optional) Template
INLINETEMPLATEis used (instead of the default
otherversionpagetemplate) in the inline directive listing the other pages.
A pagespec can match pages marked as a version of something using the pagespec
versionof. It accepts the same arguments as the arguments as the
versionof directive, that is:
versionof(name=foo): Match pages which are a version of page
versionof(name): Match pages which are a version of the current page.
versionof(parent): Match pages which are a version of the parent page.
versionof(label=bar): Match pages which are a version of some abstract object labelled
Moreover, it takes one additional argument:
versionof(any): Match pages which are a version of anything.
An additional pagespec
latestversion is provided. It accepts the same arguments as the
versionof pagespec (that is:
latestversion(any)) but only the most recent page is matched.
As a side effect, this plugin also provides the
latest_tagged(TAG) pagespec. It matches one single page: the most recent page tagged with the given tag.
[[!redirect ]] (from the redirect plugin) can be used together with this package. For instance, a page containing the directive
[[!redirect pages="versionof(page)"]] will redirect to the most recent page marked as a version of the current page.
Code and documentation can be found here : https://atelier.gresille.org/projects/gresille-ikiwiki/wiki/PageVersion.