How have you solved menu with dynamic docs? Brain storming

I have a folder inside my repo that’s called “help” inside that folder I have subfolders and .md files with help files.

What I have done is that I have a foreach in the menu to write up the structure.


        New-UDListItem -Label 'Hjälp' -Icon (New-UDIcon -Icon IdBadge -Size lg) -Children {
            New-UDListItem -Label 'Release Notes' -Icon (New-UDIcon -Icon MagnifyingGlass -Size lg) -Children {
                foreach ($rls in $ArchiveReleaseNotes) {
                    New-UDListItem -Label "$($rls.Name)" -OnClick {

And now I want to open a new page with the $ variable so I can show the correct file at the page. In that case I have a hole dynamic page and that’s great. I’m thinking of making a function of it.

Anyway, my guess is that this is nothing new and it’s maybe a better way to do it?
@Adam how have you solved it?

It must be a better way to do this.
Maybe I can create a script that convert the .md files to .html files if the .md file is changed later than the .html file and also create a .ps1 file of it as a page in that way the links should always work also so people can link the documentation also.

Powershell 7 has ConvertFrom-Markdown so the following will work.

$html = ConvertFrom-Markdown -Path "<path to md file>"
    New-UDHtml -Markup $html.Html

If you create a UD page and some navigation for your dashboard and pass a parameter for the filename like this.

$Navigation = {
    New-UDListItem -Label "My Page Title" -Href '/Pages?article=<filename of an MD>' 
$Pages = @()
$Pages += New-UDPage -Name 'Pages' -Content {
    $html = ConvertFrom-Markdown -Path "<apth to folder>\$"
    New-UDHtml -Markup $html.Html
} -NavigationLayout permanent -LoadNavigation $Navigation

New-UDDashboard -Title 'Docs' -Pages $Pages

You could easily dynamically build the Navigation element based on the directory contents.


1 Like