lukasgeiter / mkdocs-awesome-pages-plugin

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

Having trouble using multiple .pages files in different directories #71

Open jeffjg opened 1 year ago

jeffjg commented 1 year ago

Hello!

I'm having trouble with using multiple .pages files in multiple directories. I have one .pages file in the root directory that's intended to be used for the main navigation, and then another .pages file in a directory called design that's intended to be used for the navigation of the pages within the design section.

Here's the folder directory:

/docs
  .pages
  /design
    .pages

And here's what the .pages files look like. This is the first one, in the root /docs directory:

nav:
    - Curriculum: curriculum
    - Design: design
    - Items: items
    - Quality Control: qc

And here's the content in the .pages file within the design directory:

nav:
    - Introduction: general
    - Book Design: book_design
    - Figure Design: figure_design

The issue is when I click on the Design link in the top nav on my website, it goes to the design/general location. What I'm hoping to have it do is instead go to the design/index.md file, and then once the Introduction link in Design is clicked, then it goes to the design/general location.

Does anyone have any idea how I can it to function like this?

Thank you!!!

kamilkrzyskow commented 1 year ago

Hi, in your design .pages file try:

nav:
    - index.md
    - Introduction: general
    - Book Design: book_design
    - Figure Design: figure_design

or if you're using the i18n plugin:

nav:
    - ... | index*.md
    - Introduction: general
    - Book Design: book_design
    - Figure Design: figure_design

I'm using the material theme with index pages and navigation tabs features on, together with the i18n plugin: For the top level (root -> tab) I have to use the third method in the tab directories to directly set index at the top. Apart of that in deeper directories I just use ... in the nav and it does include the index at the top.

It breaks at the navigation tab level since it's a feature of the material theme that could get the link before the ... is processed by the plugin 🤔, but I never investigated it 🤷.

EDIT: I removed the copy-paste typo example, which I later explain doesn't work 😅

jeffjg commented 1 year ago

You beautiful genius! Thank you, it works!

lukasgeiter commented 1 year ago

MkDocs always navigates to the first page of a section (folder). Therefore, as @kamilkrzyskow suggested, you need some sort of index page if you don't want users to go straight to the introduction.

@jeffjg I assume your question has been answered and this issue can be closed?