wintercms / wintercms/wn-pages-plugin
Static menu component does not display URLs for the static pages
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 15
- Forks
- 23
- Avg merge
- 56m
- Merged PRs (30d)
- 2
Description
- 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:
- Require winter/wn-pages-plugin plugin to clean Winter CMS installation
- Go to Pages section, create some static pages
- 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
- Go to CMS section select Layouts and select default.htm and add component Pages / Static menu
- Display the component somewhere in the body: {% component 'staticMenu' %}
- 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:
- Repeat steps 1-4 from "Scenario 1"
- Add this code to the body:
{% for item in staticMenu.menuItems %} <li><a href="{{ item.url }}">{{ item.title }}</a></li> {% endfor %} - Check the frontend - you will see, that the "item.url" is empty if the Type is Static page
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the Pages / Static menu component and inspect how its menuItems are built for Static page references. Compare the generated values with custom URL and CMS page items; done means Static page entries expose a URL and render working links in both scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- content
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100