Breadcrumbs - Hiranyaloka/Documentation GitHub Wiki

Table of Contents

Breadcrumbs for pages and folders

On an MT4+ powered site that has pages and folders, the following code delivers a completely effective breadcrumb navigation trail:

<a href="<MTBlogURL>">Home</a> &raquo;
<MTParentFolders> 
  <a href="<MTBlogURL><MTFolderPath>"><MTFolderLabel></a> &raquo;
</mtparentfolders>
<strong><MTPageTitle></strong>

Sidebar listing of folders/pages

Error in MT Template Tag Reference Appendix Documentation for SubFoldersRecurse

The MT4 documentation on the tag has an error in the code:

<MTTopLevelFolders>
  <MTSubFolderIsFirst><ul></mtsubfolderisfirst>
    <MTIfNonZero tag="MTFolderCount">
        <li><a href="<$MTFolderArchiveLink$>"
        title="<$MTFolderDescription$>"><MTFolderLabel></a>
    <MTElse>
        <li><MTFolderLabel>
    </mtelse>
    </mtifnonzero>
    <mt:SubFolderRecurse>
    </li>
<MTSubFolderIsLast></ul></mtsubfolderislast>
</mttoplevelfolders>
There's simply no such thing as === Recipe 1: List all pages and folders in the system === This will list all pages (contained in a folder) and folders across the weblog. <pre><ul> <MTTopLevelFolders> <li><a href="<MTFolderPath>"><MTFolderLabel></a></li> <ul> <MTPages> <li><a href="<MTPagePermalink>"><MTPageTitle></a></li> </mtpages> </ul> <ul><MTSubFolderRecurse></ul> </mttoplevelfolders> </ul></pre> === Recipe 2: List only folders, not pages === This lists <b>only the folders and sub-folders</b>, but no pages. <pre> <ul> <MTTopLevelFolders> <li><a href="<MTFolderPath>"><MTFolderLabel></a></li> <ul> </ul> <ul><MTSubFolderRecurse></ul> </mttoplevelfolders> </ul> </pre> === Recipe 3: List only top level folders === This lists only the <b>top level folders</b>, no sub-folders or pages. <pre> <ul> <MTToplevelFolders> <li><a href="<MTBlogURL><MTFolderBasename>/index.php"><MTFolderLabel></a></li> </mttoplevelfolders> </ul> </pre> === Recipe 4: List all pages and sub-folders in the present folder === Conceivably useful in a sidebar on every page, this lists <b>all</b> the pages and sub-folders in the present page folder. Note that it also lists the current page. <pre> <ul> <MTPageFolder> <MTPages sort_by="date"> <li><a href="./<MTPageBasename>.php" id="<MTPageBasename>"><MTPageTitle></a></li> </mtpages> <MTSubFolders> <li><a href="<MTBlogURL><MTFolderPath>/index.php"><MTFolderLabel> &raquo;</a> <ul> <MTPages><li><a href="<MTPagePermalink>"><MTPageTitle></a></li></mtpages> <MTSubFolderRecurse> </ul> </li> </mtsubfolders> </mtpagefolder> </ul> </pre> === Recipe 4.5: List all pages <i>except</i> the current page and sub-folders in the present folder === This works very well. It eliminates the current page from the listing, and lists all the other pages, sub-folders and sub-folder pages in the present page folder. <pre> <ul> <mt:setvarblock name="curpage"><mt:pageid></mt:setvarblock> <MTPageFolder> <MTPages sort_by="title" sort_order="ascend"> <mt:setvarblock name="listpage"><mt:pageid /></mt:setvarblock> <mt:unless name="listpage" eq="$curpage"> <li><a href="./<MTPageBasename>.php" id="<MTPageBasename>"><MTPageTitle></a></li> </mt:unless> </mtpages> <MTSubFolders> <li><a href="<MTBlogURL><MTFolderPath>/index.php"><MTFolderLabel> &raquo;</a> <ul> <MTPages><li><a href="<MTPagePermalink>"><MTPageTitle></a></li></mtpages> <MTSubFolderRecurse> </ul> </li> </mtsubfolders> </mtpagefolder> </ul> </pre> == CREDITS == Almost all of this is from <b>caribou's</b> [http://forums.sixapart.com/index.php?showtopic=64145&hl=folders post] at the [http://forums.sixapart.com/ sixapart forums].

--Gautam Patel 22:03, 15 December 2007 (PST)

⚠️ **GitHub.com Fallback** ⚠️