Table of contents
  1. 1. Script Source
  2. 2. Script in Action

This script shows how to find the page that defines tag (e.g. define:extensions).  The script uses the wiki.getsearch function to find at most one page that is tagged with the sought tag.  Once found, it checks if the tag is linked to a definition page.  If so, it emits a link with a description, otherwise it shows text describing that a page could not be found.

Script Source

{{
var tag = "extensions"; 
var found = wiki.getsearch("tag:" .. tag, 1, _, "type:wiki" ); 
if(#found) { 
    var def = found[0].tags[tag].definition; 
    if(def) web.link(def.uri, "Tag definition at " .. def.path); else "(no definition for '".. tag .."')";
} else "(no page found)";
}}

Script in Action

(no definition for 'extensions')

Tag page
You must login to post a comment.