Menu Link 'Code Link' help

I’m trying to use some Menu Links to create Navigation items that don’t map to an actual page (they go to a scripted endpoint).

‘External’ doesn’t seem to allow for relative paths, like /inventory/new. It makes it a https://inventory.new. I can’t use ‘Internal’ links because, well, that makes you select a page that exists.
So, there’s this final option ‘Code Link’ but I can’t make heads or tails of it and there is no documentation about it. Might have been something in the old Listserv, but you killed it. (Still mad, as there is 15+ years of good knowledge there)

Image is what I thought would work, does not. (link ends up going to /dotAdmin)

I would still love to have some instructions, somewhere, on how to use Code Links, but
there is a workaround. Use the ‘External Link’ option, but just put in the relative path, i.e. /whatever/where.
Then in your nav code, you can do something like this:
#set ($fixlink=$nav.link)
##if it doesn’t have a period, it doesn’t have a host (domains need a . ) - strip the https:// from it
#if (!$fixlink.contains(“.”)) #set($fixlink=$fixlink.replaceAll(“https://”,””))) #end

then your href=”$fixlink” will work regardless.

The best part about dotCMS is that there is always another way to skin the cat.
Lastly, why aren’t Menu Links content? I would love to be able to extend it - one of my sites likes to have different colored links based off of where it is going.

Hi Mark! Very sorry about the delay in responding, we have a couple people looking at it internally and will get back to you here in a little bit with some guidance on Code Links.

The workaround makes sense, one of the engineers should be able to validate it as a best practice or if Code Link should be the way to go - either way we will get our docs updated on best way to address your use case. Thanks for bringing it up!