Gibe / Umbraco-Link-Picker

Link picker property editor for Umbraco 7
12 stars 10 forks source link

Link Picker links do not update after target node moved to new location or name updated. #18

Closed jattwood closed 7 years ago

jattwood commented 7 years ago

First off, great package, thanks! Having an issue when a node is selected via Link Picker and then the node name is changed or the node moved. Looks like LP just looks to the relative path and not the node id for mapping. Is there any fix for this or another razor implementation that I can use to get around this?

Thanks,

Jamie

stevetemple commented 7 years ago

I believe there is a node id stored along with the path in the json so you can use that to get the node and then the url instead of the path that's also stored there, that's how we use it

karltynan commented 7 years ago

Yes you can get the node ID for internal links - the Url is used for external links.

karltynan commented 7 years ago

On the most basic level, you can Umbraco.Content(Id).Url etc etc.

jattwood commented 7 years ago

Thanks for the quick response. Ok so on a few levels then, I would suggest updating/elaborating on the usage in the razor documentation - I would be happy to write this for you if you want. The assumption for me was that item.url would return either the URL of the node or the absolute path url if used. So essentially, one needs to test if id is present, if so resolve via node id, if not present then use url. On the admin side though, if a node was selected, it's name and path really should be updated after rename or move (as the content picker does) when you return to the link item. I guess I would call that expected behavior, at least that was for me. It is probably over my head to look into implementing this functionality from your source but I can try.

karltynan commented 7 years ago

Documentation has been updated to show how to get internal URLs using the Id when passed into Umbraco.Content()

karltynan commented 7 years ago

At this stage, there are no plans to update URLs as a result of a name change (resulting in a URL change) in Umbraco.