Change folder number from admin

Hi! Grav newbie here with a question: is there a way in the admin to change the folder number prefix?

I am using this to order collections and would like to access this from admin. Is this not possible or is there other way to achieve a custom / manual order from admin?


Advanced tab, upper right, Sortable Pages. Just drag and drop :wink:

Thank you, that was exactly what I wanted.

I missed this is the learn.getgrav site because the description for this is section:

The Ordering section gives you the ability to configuring page ordering of non-numbered folders.

I think this description is wrong. Maybe something like:

The Ordering section gives you the ability to use drag and drop to reorder pages that are siblings to the current page (this will modify each page’s folder’s number prefix).
Disabling the number prefix hides the page in the navigation (makes it invisible) and disables it in the Sortable Pages interface."

Should I try to submit a correction for this?

Thanks again!

But is this really true? :thinking:

@Karmalakas, Isn’t it?

Well… I have a mix of numbered and not numbered folders and they all are visible unless I specifically set visibility to false :thinking: I’ll have to check this again to be 100% sure, but IIRC, that’s how it’s on my website :confused:

You are right, the page without folder prefix is included in pages.children.

New version:

The Ordering section gives you the ability to use drag and drop to reorder pages that are siblings to the current page (this will modify each page’s folder’s number prefix).
Disabling the number prefix is equivalent to setting the page ‘visible’ variable to false and disables it in the Sortable Pages interface.

Just checked. It’s weird - it really becomes invisible in menu unless you mark it as visible :confused: Makes things more confusing

@jrzav, @Karmalakas, Maybe the following might shed some light…

What does what with respect to a page’s ‘visibility’ property and hidden/visible menu-items?


  • ‘Folder Numeric Prefix’
    • Enabling field ‘Folder Numeric Prefix’ only adds a numeric prefix to the folder containing the page file. Disabling removes the numeric prefix.
    • It does not ‘set’ the visibility or anything else of a page.
  • ‘Sortable pages’
    • This array field, allows the user to order siblings having a numeric prefix. It changes the order, by changing the numeric prefixes of the folders.
    • It does not ‘set’ anything else.

Grav core:
It is the core that sets the page’s visibility property depending the page’s frontmatter and attributes of its folder.

When a page gets initialized it runs (amongst others) the following methods that impact property ‘Page::visible’. In order of execution:

  • Page::header();
    Sets ‘Page::visible’ according the value set in frontmatter
  • Page::visible();
    If ‘Page::visible’ has not yet been set, set it according the presence of numeric prefix of folder.
  • Page::modularTwig(strpos($this->slug(), ‘_’) === 0);
    Sets ‘Page::visible’ to false if is a modular page.
  • Page::published();
    If Page::published is false, set Page::visible to false

A collection adds pages according the ‘items’ field in the definition. It does not discriminate between visible/invisible. Both are added.
It provides functions ‘Collection::visible()’ and ‘Collection::invisible()’ to filter based on the value of ‘Page::visible’

A menu is only defined in a template. A template can create a menu as it sees fit. Usually, a collection of pages is being used to create the menu. In particular the collection of children of a page: ‘page.children’. And more specifically only the visible children: ‘page.children.visible’.


  • Showing/hiding menu-items based on property ‘Page::visible’ is a convention.
  • Only the templates, by adhering to the convention, shows/hides menu-items. Not Admin, nor core.
  • Enabling/disabling ‘Folder Numeric Prefix’ in Admin, may have the side effect that a page is shown or not shown in the menu.

NB: Please correct me if my view on this should be corrected…

Yep, figured this should happen somewhere in core and all makes sense, but this:

This doesn’t make sense at all IMO :thinking:

@Karmalakas, Please elaborate…

If, during initialisation of the page, ‘Page::visible’ has already been set by frontmatter, the value will not be overridden by the later check for the presence/absence of a numeric prefix of the folder.

Frontmatter ‘beats’ numeric prefix.

But how are numbered folders different from non-numbered? They are exactly the same, except, that it lets you order them more easily. IMO numeric prefix should have nothing to do with visibility.

Just had a thought. How is 00 prefix treated? :slight_smile:

@Karmalakas, See Basics/Basic Tutorial/Content Basics

The other thing that the numeric portion of the folder name does is explicitly inform Grav this page should be visible in the menu. It is important to note that the numeric portion up to and including the . will be removed from URLs.

There is no difference indeed, but it does have a side effect by convention/rule/definition.

1 Like

Must have forgotten this part when I read the docs a few months ago :slight_smile: Good that it’s documented, but still a weird decision to change visibility depending on property that’s supposed to be for ordering :slight_smile: