Closed AussieInSeattle closed 1 year ago
Yes that's correct, you need to use the extension method
.Url()
that fails also (this is for type=link, not type=content) - see screenshot - am I missing a using that would make .Url() work?
Hmmm .Url() is in the UmbNav.Core DLL
It's been a long time since I've touched V1, I think link is for external URLs, I'd need to get a V8 site up and running to debug
I think link is for external URLs Correct - this is only an issue for external url's - am assuming this is only coming up now as it's rare to have external url's in your top navigation where this package is likely mostly used?
Yeah I think that could be the case, I've done this and got it working in V10+ So I presume it's a bug specific to V8...
I'll do some digging...
Can you give me an example of the backoffice item, so I can be 100% sure I'm debugging it correctly
When debugging I can see .Url (string) populated under Non-Public Properties - so I think it's a matter of making .Url public but only when type=link - not sure who you'd do that
That was made internal for a specific reason, it broke things with the multilingual which is why the extension method was brought in... I will debug this and get back to you
Example below - cut off the bottom so I didnt have to blur out my content tree
That was made internal for a specific reason, it broke things with the multilingual which is why the extension method was brought in... I will debug this and get back to you
thanks - let me know if you need more info
I've just run V8 and it works for me:
These are the two usings:
@using UmbNav.Core.Extensions
@using UmbNav.Core.Models
Are you sure the Url()
you are using in your code is the UmbNav one?
Your error seems to say PublishedContentExtensions.Url()
whereas the UmbNav one is UmbNavItemExtensions.Url()
Just to add the UmbNav extension does a null check here: https://github.com/AaronSadlerUK/Our.Umbraco.UmbNav/blob/ac2e3a9a59e8c2c5c8a8274443dad912ad9c0b8f/src/UmbNav.Core/Extensions/UmbNavItemExtensions.cs#L125
and returns .Url if it is null here: https://github.com/AaronSadlerUK/Our.Umbraco.UmbNav/blob/ac2e3a9a59e8c2c5c8a8274443dad912ad9c0b8f/src/UmbNav.Core/Extensions/UmbNavItemExtensions.cs#L151
good catch - missing using statement - adding this to view fixed it:
@using UmbNav.Core.Extensions
Will buy you a beer at CG for your troubles :-)
Glad you got it working!
Which exact Umbraco version are you using? For example: 8.7.0 - don't just write v8 or v9
8.16.0
Bug summary
Umbraco 8.16.0 UmbNav 1.1.4
Code below fails as .Url is set to internal .Url() also fails - when linking to umbraco content, .Content.Url() works - this is just an issue when the type is Link.
Specifics
Seems to be that this line is set to internal? https://github.com/AaronSadlerUK/Our.Umbraco.UmbNav/blob/umbraco-v8-v9/src/UmbNav.Core/Models/UmbNavItem.cs#L67
Steps to reproduce
see code above
Expected result / actual result
No response