Skip to content

menu.main nested items with pageRef link to homepage on mobile, but work correctly on desktop #1027

Description

@mragochar

Description:

I have a menu.main entry with a link-less parent (identifier only) and 3 children using pageRef, structured for a dropdown:

menu:
  main:
    - identifier: devops
      name: Dev Stuffs
      weight: 1
    - name: Git & Github
      pageRef: /git
      parent: devops
      weight: 1
    - name: Docker
      pageRef: /docker
      parent: devops
      weight: 2
    - name: Linux Fundamentals
      pageRef: /linux
      parent: devops

Desktop behavior: All 3 children link correctly to their respective pages.

Mobile behavior (hamburger menu): All 3 children link to the homepage (/) instead of their intended page.

Steps to reproduce:

  1. Add a menu.main group as above, with a parent that has no url/pageRef (identifier only), and children using pageRef.
  2. Build and view the site on a mobile viewport / narrow browser window.
  3. Open the hamburger menu, expand the dropdown, and click any child item.
  4. Observe it navigates to the homepage instead of the target page.

Workaround found: Changing the children's pageRef to url (with the equivalent literal path, e.g. pageRef: /giturl: /git/) fixes the mobile links immediately. Desktop behavior is unaffected either way.

Environment:

  • Hugo version: hugo v0.163.3-4d22555aebf458d5d150500c9ac4bee5b24cf0d3+extended+withdeploy linux/amd64 BuildDate=2026-06-18T16:18:24Z VendorInfo=gohugoio
  • Hextra version: v0.12.3

Question: Why does this happen only on mobile and not desktop? Is this a known bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions