verbb / navigation

A Craft CMS plugin to create navigation menus for your site.
Other
90 stars 23 forks source link

Custom URLs in a multisite setup share the same URL across all nodes. #405

Open jlachancekffein opened 2 months ago

jlachancekffein commented 2 months ago

Describe the bug

When the propagation method of a navigation is set to Save nodes to all sites enabled for this navigation, the modification of the url of a node of type Custom Url, the modification is applied to each site.

However, the label is correctly translated on each site. The issue is only with the URL.

I understand that, when I create a new node, that the same value is save in each others sites, but after modification, is suppose to apply only to the selected site.

For now, we fix it by changing the propagation mode to Only save nodes to the site they were created in but it break the relation between the navigation between site.

Im pretty sure that Craft, by default with the propagation mode set to Save nodes to all sites enabled, duplicate the content of the element in each site, but manage by sites after modification.

Steps to reproduce

  1. Create a custom URL on any site by filling in the title and URL.
  2. Switch to another site in the Navigation plugin to edit the nodes.
  3. Update the title and URL.
  4. Return to the first site to edit the custom URL.
  5. The title remains the same, but the URL is the one defined for the other site.

Craft CMS version

5.4.2

Plugin version

3.0.4

Multi-site?

Yes

Additional context

No response

engram-design commented 2 months ago

This is a good point, and It's something that's been on my list to do for a while now. Essentially, we need to create a record of a node for each site enabled for a node.

While Craft does this automatically for a Node, because it's an element, there's only a few things that are stored site-specific through that. The title, slug, uri and content are site-specific for all Elements. You can see this in the elements_sites table.

However, the things that Navigation Nodes have such as the url, classes, urlSuffix, etc are not site-specific.

This'll be part of a larger refactor coming soon!

MoritzLost commented 1 month ago

@engram-design We've also run into this problem. Can you give an ETA for this large refactor?

I think Craft also solved this issue for a couple of native properties, like the alt field which was moved to the elements_sites table to be able to translate it.

engram-design commented 1 month ago

No ETA sorry, and yes those work due to them being stored as content due the field layout being localized.