verbb / navigation

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

craft.navigation.render() doesn't use custom title #381

Closed cmalven closed 7 months ago

cmalven commented 7 months ago

Describe the bug

I am using Navigation to link to our homepage multiple times, with each using URL Suffix to link to a unique #anchor. I've given each of these links a unique Title, but when I output them using {{ craft.navigation.render('navPrimary', {}) }} every link outputs with the title Homepage.

Is this the intended behavior?

Screenshot 2024-01-19 at 14 30 47@2x Screenshot 2024-01-19 at 14 32 24@2x

Steps to reproduce

  1. Create a navigation with links to Entries
  2. Give each of these entries a unique Title
  3. Render the navigation using craft.navigation.render()

Craft CMS version

4.5.10

Plugin version

2.0.22

Multi-site?

No

Additional context

No response

engram-design commented 7 months ago

That's odd, certainly not seeing that on my end

image

Does the same thing happen when manually rendering nodes?

{% set nodes = craft.navigation.nodes('navPrimary').all() %}

<ul>
    {% nav node in nodes %}
        <li>
            Title: {{ node.title }}<br>
        </li>
    {% endnav %}
</ul>
cmalven commented 7 months ago

@engram-design I get the same result using your code to loop through each node.

Screenshot 2024-01-23 at 17 56 03@2x
engram-design commented 7 months ago

That's quite odd. I don't suppose you'd be able to share your database? Completely understand if you're not able to, but if you are, send it to support@verbb.io and hopefully I can reproduce that.

cmalven commented 7 months ago

Thanks @engram-design I've reached out to you at that email address.

engram-design commented 7 months ago

Thanks for sending that through! I can see the issue, in that you've only renamed the nodes for siteId 1 and not siteId 2, which is the primary site.

This is a screenshot of your primary site's navigation nodes

image

And in the content table it's more clearer:

image

I'm not actually sure if it's a bug that you have two identical sites, so maybe that's more the issue?

cmalven commented 7 months ago

@engram-design Yep that's definitely it! Thanks, I should've noticed that it was showing the site selection dropdown, but I have no idea how an additional site was created. Definitely wasn't intentional. Appreciate you taking a look.