Copying a page duplicates routes.default, so both pages claim the same address
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
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
- 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.
More from getgrav/grav-plugin-api
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
getgrav/grav-plugin-api#60 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
getgrav/grav-plugin-api#51 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
getgrav/grav-plugin-api#42 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
getgrav/grav-plugin-api#40 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
getgrav/grav-plugin-api#32 · 1 comment ·
All issues in getgrav/grav-plugin-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Featured image not passed to checks in the Tasks column or publish blocksPossibly taken @roborourke claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
humanmade/publication-checklist#100 ·
Maintainers usually reply within 1 day
-
bug customer-reported
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
MagnaCapax/PMSS#1072 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
verbb/formie#3013 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
hestiacp/hestiacp#5800 · 1 comment ·
Maintainers usually reply within 1 day