Build your own Sitemap routine

Instead of using the sitemap macro, you can use SXML to get more granular control over what it does internally.

For this to work, simply generate a datatable using an sqlquery macro, and format the datatable using viewhierarchy.

 

Smartsite SXML CopyCode image Copy Code
<se:viewhierarchy keyfield="nr" parentfield="parent" childorderfield="listorder" rootnode="24665">
    <se:parameters>
        <se:parameter name="inputdata">
            <se:sqlquery resulttype="datatable">
                <se:parameters>
                    <se:parameter name="sql">
                        select nr, parent, title, listorder, sortindex, adddate 
                        from {channel.view()}
                    </se:parameter>
                </se:parameters>
            </se:sqlquery>
        </se:parameter>
        <se:parameter name="format">
            <se:rowformat>
                <li>
                    <a href="{channel.link(this.field(nr))}">{this.field(title)}</a>
                    {this.childlevelresult()}
                </li>
            </se:rowformat>
            <se:levelformat groupby="this.field(level)">
                <ul>{this.levelresult()}</ul>
            </se:levelformat>
        </se:parameter>
        <se:parameter name="resultformat">
            <ul>
                {this.result()}
            </ul>
        </se:parameter>
    </se:parameters>
</se:viewhierarchy>
Example Result CopyCode image Copy Code
<ul>
                
                <li>
                    <a href="/test.net?id=24666">Tools</a>
                    
                <ul>
                <li>
                    <a href="/test.net?id=SCREWDRIVERS">Screwdrivers</a>
                    
                <ul>
                <li>
                    <a href="/test.net?id=24668">Screwdriver XL Plus</a>
                    
                </li>
            
                <li>
                    <a href="/test.net?id=27435">Screwdriver 300GT</a>
                    
                </li>
            
                <li>
                    <a href="/test.net?id=27436">Screwdriver Deluxe 170</a>
                    
                </li>
            </ul>
            
                </li>
            </ul>
            
                </li>
            
            </ul>