Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Copying a page duplicates routes.default, so both pages claim the same address

Open
#27 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
php
Domain
api, backend

Research direction

Start with Folder::copy(), then trace Page::route() and Pages::buildRoutes() to understand how default routes and aliases are copied and registered. Compare the existing slug-copy behavior with the routes frontmatter cases described here. Done means the project has an agreed copy policy for routes.default and aliases, with duplicate-address behavior covered by tests.

Written by the indexing model from the issue text.

Description

Split out of #25 / #26, where it was raised by @Gleydar.

Folder::copy() reproduces a page's frontmatter byte for byte. #25 fixed the slug: half of that: a copied page now gets its own slug so it stops claiming the source's address.

routes.default clashes in exactly the same way and is not covered:

---
title: Test
routes:
    default: /a-fixed-address
---

Page::route() short-circuits to $this->routes['default'] when it is set, so the copy answers to the same address as the source regardless of its folder or its slug. Pages::buildRoutes() also registers routes.aliases into the same map, so aliases can collide too.

Not fixed alongside the slug because the right behaviour is less obvious. Deleting the whole routes block (which the original PR proposed) also throws away aliases and canonical, and silently dropping something an author typed is worse than the clash. Admin-classic copies routes verbatim too, so this is long-standing rather than a regression.

Worth deciding whether a copy should drop routes.default only, blank it, or leave it and let the admin warn. Low urgency now that the admin page views key on the structural route (getgrav/grav-plugin-admin2#154), so a duplicate address no longer blanks the listing.

Dominant language
PHP
Stars
5
Forks
10
Avg merge
8h 29m
Merged PRs (30d)
6

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from getgrav/grav-plugin-api

All issues in getgrav/grav-plugin-api

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.