Hlinks

Summary: Create hierarchical pages
Version: 2020-04-27
Prerequisites: UTF-8
Status: beta
Maintainer: Michael Eager
License: GPL2
Categories: Markup | Links | Hierarchy | PageNaming

See also: Hg | Cluster | Hierarchical Groups

Users: (view? / edit)

Questions answered by this recipe

How can I organize pages hierarchically?

How can I create a breadcrumb trail to previous pages in the hierarchy?

Description

Hlink allows you to create an hierarchical page structure in PmWiki, without using Groups or other internal structures. It creates an overlay on the page name space, where each created page encodes its place in the hierarchy in its name. An added markup generates a breadcrumb line listing the pages in order. A GUIbutton is added to insert a separation character.

Installation

  • download Hlink.phpΔ to your cookbook directory.
  • download rightangle.gifΔ to your pub/guiedit directory.
  • add the following line to your config.php file:
    include_once($FarmD.'/cookbook/Hlink.php');

Do not install both Hg and Hlink; Hg has a markup which conflicts with Hlink.

Configuration

UTF-8 must be enabled.

To change the separator character (not recommended), add $HlinkSeparator = "\u{00bb}"; to your configure file, changing the character code as desired.

Usage

To create hierarchical link use markup [[*newpagename]]. This will create a reference to a page whose name is constructed by taking the current page name and appending newpagename separated by a special character (by default the right-pointing double angle quotation mark, », UTF-8 u00bb). When displayed on the page, this markup will only show the newpagename name, not the full page name.

To display a breadcrumb line which displays the current page's position in the hierarchy, insert (:breadcrumb:). This can be included on each page, or inserted in Site.PageHeader or in Group.PageHeader pages.

Example

To create a hierarchical collection of related pages which has the following organization:

     Main/Maps
     |-- Europe
     |   |-- France
     |   |   |-- Paris
     |   |       |-- 2000
     |-- North America

On the Maps page, insert [[*Europe]] and [[*North America]]. This will create links to pages named Main.Maps»Europe and Main.Maps»NorthAmerica. When the Main.Maps»Europe page is created, add [[*France]] which will creat a link to Main.Maps»Europe»France, and so forth on each new page.

On each page, references to regular non-hierarchical pages are unchanged. References to child pages use this new [[* markup. References to other pages in the hierarchy need to spell out the complete "path" to the page, using the separation character between each "level". A reference to the Paris 2000 map from another page would be [[Maps»Europe»France»Paris»2000|Paris map]]. You can use the GUIbutton to insert the separator.

Notes

To do / some day / maybe

  • Add markup to refer to parent page.
  • Add markup to refer to sibling page.

If you have future plans or wishes for this recipe.

Change log / Release notes

2020-04-27: Initial version

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also

Hg -- Unsupported and incompletely documented hierarchical groups
Cluster -- Group clustering with limited page granularity
HierarchicalGroups -- Discussion why PmWiki doesn't have hierarchical groups.

Contributors

Michael Eager

Comments

See discussion at Hlinks-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.