AaronSadlerUK / Our.Umbraco.UmbNav

Drag and drop menu editor for Umbraco V8, V9 and V10+
MIT License
10 stars 15 forks source link

Non Content Link Url not accessiable in Views #78

Closed jamescutts closed 1 year ago

jamescutts commented 1 year ago

Which exact Umbraco version are you using? For example: 8.7.0 - don't just write v8 or v9

version 10.5.1

Bug summary

When adding a menu item that is not internal content e.g. Link to https://google.com this value is not accessible due to UmbNavItem.Url being an internal property, thereby giving no way to render these within views.

Specifics

No response

Steps to reproduce

Example of configured menu item containing an external non-content link.

image

Expected result / actual result

A property is accessible wit the url for a non content link allowing code similar to the following to render the link to an external url.

<a href="@(child.Content != null ? child.Content.Url() :  child.Url)" target="@child.Target">
    @child.Title
</a>
AaronSadlerUK commented 1 year ago

.Url it not used, is internal and depreciated.

.Url() (the extension) works with both internal and external links.

You will need to check you have included the using statement in your view

@using UmbNav.Core.Extensions