Docly Developers
DocsUpdated 18 Oct 2026

Breadcrumb example

Example on how to show the current navigation path for a page. The path comes from request.url, which is URL-encoded, so each part is decoded and HTML-encoded before it is shown.

"#/Nav.hash" example file

#var parts = request.url.trim("/").split("/").filter(x => x != "")#
<nav aria-label="breadcrumb">
    <ol class="breadcrumb">
        <li class="breadcrumb-item">
            <a href="/">Home</a>
        </li>

#var curpath = ""#
#var index = 0#
#for(var item of parts) {#
    #curpath = curpath + "/" + item#
    #var label = docly.htmlEncode(decodeURIComponent(item).replaceAll("-", " "))#
    #if (index == parts.length - 1) {#
        <li class="breadcrumb-item active">#label#</li>
    #} else {#
        <li class="breadcrumb-item">
            <a href="#curpath#">#label#</a>
        </li>
    #}#
    #index++#
#}#
    </ol>
</nav>

Include this breadcrumb in other HASH files with include:

<!--#include file="#/Nav.hash"-->