Tinderbox v10 Icon

^setRoot( [newRoot] )^


Export Code Type: 

Export Code Scope of Action: 

Export Code First Added: 

Export Code in Current Baseline: 

Export Code Last Altered: 

 Export Mark-up   [other codes of this type]

 document   [codes with similar scope]

 v4.0.0

 Baseline

 As at baseline


^setRoot( [newRoot] )^

The ^root^ code (see) normally exports the relative path from a note to the top level of the Tinderbox document. This is valuable for defining relative paths, especially in macros. But in some cases you may want a relative path in one page (an HTML page, say) and an absolute link in another (an RSS feed, where relative links may be forbidden).

Thus, the export element

^setRoot(newRoot)^

tells Tinderbox to use its first argument (newRoot) as the value of ^root^ until either

To restore relative URLs, use ^setRoot()^ with no arguments.

For example:

^setRoot(https://example.com/)^ 

Using ^setRoot()^ to set the logical host or root path for a page affects not only ^root^ but also ^url^, ^childLinks^, and ^basicLinks^.


See also—notes linking to here: