lukasgeiter / mkdocs-awesome-pages-plugin

An MkDocs plugin that simplifies configuring page titles and their order
MIT License
452 stars 35 forks source link

Awesome pages doesn't respect specified file order over `...` pattern #55

Closed Andre601 closed 2 years ago

Andre601 commented 2 years ago

I host a website listing sounds enum names for the SpigotMC project.

Now I want to use Awesome pages to not have to update all pages every time a new update releases, but I encounter a rather strange issue, where the order of the pages in the navigation is completely out of order.

My intended order is:

- Spigot 1.8.x
- Spigot 1.9.x
- Spigot 1.10.x
- Spigot 1.11.x
- Spigot 1.12.x
- Spigot 1.13.x
- Spigot 1.14.x
- Spigot 1.15.x
- Spigot 1.16.x
- Spigot 1.17.x
- Spigot 1.18.x

but the order as of now is

- Spigot 1.10.x
- Spigot 1.11.x
- Spigot 1.12.x
- Spigot 1.13.x
- Spigot 1.14.x
- Spigot 1.15.x
- Spigot 1.16.x
- Spigot 1.17.x
- Spigot 1.18.x
- Spigot 1.8.x
- Spigot 1.9.x

and I'm not sure if this is now caused by awesome pages, the Material theme or even MkDocs itself.

I tried to force awesome pages to put the 1.8 and 1.9 pages before everything else using

nav:
- Spigot Sounds: index.md
- mc-1.8.md
- mc-1.9.md
- ...

but the order stays unaffected. The file names are correct.

Any idea what the issue is and how I could solve it?

lukasgeiter commented 2 years ago

This is a consequence of how MkDocs sorts files/pages. They are compared character by character, without any kind of special handling for (multi digit) numbers. So when the second 1 in mc-1.10.md is compared to the 9 in mc-1.9.md, 1 is smaller and therefore mc-1.10.md is listed before mc-1.9.md.

Explicitly putting 1.8 and 1.9 before ... should've worked though. Maybe you'll want to try that again.

An alternative solution would be to add zeroes to the filenames: mc-1.08.md

Andre601 commented 2 years ago

Explicitly putting 1.8 and 1.9 before ... should've worked though. Maybe you'll want to try that again.

Yeah... That doesn't work for some reason

lukasgeiter commented 2 years ago

But the nav feature works for other pages?

Andre601 commented 2 years ago

But the nav feature works for other pages?

Idk. I don't use that specific nav setups on other pages.

lukasgeiter commented 2 years ago

Okay, I've looked at your repo. The file needs to be called .pages (without an extension).

You're not the first person to run into this, so I might change it so it also works with an extension...

Andre601 commented 2 years ago

Strangely enough did it not work when I had only .pages

It's rather strange. And personally should it just use extensions, because of other things like syntax highlighting in text editors...

lukasgeiter commented 2 years ago

In hindsight I agree, having a file extension makes more sense... I'll see that I can enable support for .pages.yml out of the box.

In the meantime, you can customize the filename using a plugin option.

Andre601 commented 2 years ago

I for now changed the filenames and the nav is working as it should, thanks