wintercms / wintercms/wn-pages-plugin

Static menu component does not display URLs for the static pages

Open
#48 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Review Needed Type: Unconfirmed Bug
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:

  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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.