Skip to content

Static menu component does not display URLs for the static pages #48

@BlazOrazem

Description

@BlazOrazem
  • Winter CMS Build: 1.2.7
  • Pages Plugin Version: 2.1.4
  • PHP Version: 8.1 / 8.2 / 8.3

Description:

If there are static pages in the static menu (type Static page with Reference), these elements do not have set URL and so the links are not working, when Static menu component is attached to the layout. If there are custom URLs or CMS pages in the static menu - these are working fine, so the problem is only with Static page type of menu item.

Steps To Reproduce:

Scenario 1:

  1. Require winter/wn-pages-plugin plugin to clean Winter CMS installation
  2. Go to Pages section, create some static pages
  3. Go to Pages section, create a menu (eg. staticMenu) and add static pages from step 1. - for Type select "Static page" and select appropriate Reference in the dropdown
  4. Go to CMS section select Layouts and select default.htm and add component Pages / Static menu
  5. Display the component somewhere in the body: {% component 'staticMenu' %}
  6. Check the frontend - you will see, that the Static pages do not have "a href" attribute (probably because they don't have URLs)

Scenario 2:

  1. Repeat steps 1-4 from "Scenario 1"
  2. Add this code to the body:
    {% for item in staticMenu.menuItems %} <li><a href="{{ item.url }}">{{ item.title }}</a></li> {% endfor %}
  3. Check the frontend - you will see, that the "item.url" is empty if the Type is Static page

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions