-
-
Notifications
You must be signed in to change notification settings - Fork 228
Description
Context
I'm migrating a site with hundreds of pages from Pico CMS. I've written a script to move files from Pico's structure to Grav's one, using 3-digits folder prefix. When editing some pages, a duplicate page is created in a 2 digits-prefix folder with the same name.
How to reproduce the problem
Here is the minimal setup to reproduce the case:
- Download Grav+Admin:
wget https://getgrav.org/download/core/grav-admin/1.7.49.5and install it. I can't use the latest version https://getgrav.org/download/core/grav-admin/latest as it requires PHP version > 8.3 and my server uses PHP 8.2.29. Update the plugins to the latest versions (
). - From the command line, create a page with a 3-digits prefix:
$ pwd
/var/www/grav/user/pages
$ mkdir 005.test
$ cp 01.home/default.md 005.test/
- Go to edit the
testpages. Before:
- In the editor, the page directory is correct:
- Save the page:
After the save, you can see that the directory of the page has changed, from 005.test to 05.test.
How to fix it
The bug occurs only for pages with prefixes in the range 000 to 099, or 0 to 9.
One could say that this is desired and that the user must always use fixed-length 2-digits prefix. This rule is probably too strict as I have hundreds of pages.
The best way would probably be to have a prefix_pattern in the site.yaml config file where one can define what the ordering pattern is: prefix_pattern: DDD.
Mentions
Already mentioned in