lukasgeiter / mkdocs-awesome-pages-plugin

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

Version 2.9.2 regression in `.pages` handling #83

Closed kamilkrzyskow closed 9 months ago

kamilkrzyskow commented 10 months ago

Hello again, our docs (for now) doesn't use the newest version of mkdocs-static-i18n, just a modified 0.5.6 version, but let's move this aside. Our top level .pages files uses this structure:

nav:
    - Home:
        - ... | index*.md
    - zengin
    - genome
    - contribute

The wildcard handles both the index.md and index.lang.md names. When it works as intended in 2.9.1 it creates the following structure:

![image](https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/assets/34622465/fac76041-3a6e-4d98-bbcb-4dd4824aecbf)

In 2.9.2 it breaks resulting in a generic screen like this, which shows all of the pages without a Home section:

![image](https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/assets/34622465/98d9fb56-4626-4857-b511-ad13eaab0dd7)

The terminal doesn't show any errors. Didn't try to investigate the code, for now I'll pin the version to 2.9.1 in our repo. However, I understand this might be related to our specific config, so I might be the one to tackle the fix.

EDIT: I've tried making a minimal example, but it seems that the issue isn't directly related to the top .pages file, but rather it's something else. Maybe some inner .pages file is preventing the top level from rendering properly 🤔

lukasgeiter commented 10 months ago

Hey there! Since your repo is public, I was able to reproduce the issue. Looks like the regression was introduced with #79.

I believe it has to do with the fact that the plugin now looks up the .pages file in the files collection from mkdocs. In your case, the on_nav handler in awesome-pages is called 3 times (en, pl, cs). The files passed for en don't seem to include the .pages files whereas for the other two calls they are part of the collection.

kamilkrzyskow commented 10 months ago

Interesting 🤔 I only tested it with the local dev build which only built en to save time.

Building everything I get the same result that only the en or rather the default "first" language doesn't work whereas other languages do work.

Seems to be an issue with i18n this time (or our configuration of it), since the .pages file isn't included in the files.

In the coming days I will be porting the config to the new 1.0 release of the i18n plugin so perhaps the issue would be resolved by then if not I will report appropriately.

Thanks a lot for your time 😊

kamilkrzyskow commented 9 months ago

Upgrading to mkdocs-static-i18n==1.0.2 fixed the problem. Probably 1.0.0 too, but I just used the newest available version and added our configuration changes. Checked both before and after making changes.

Issue resolved.