Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jeffjg opened this issue Mar 31, 2023 · 3 comments
Open

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

jeffjg opened this issue Mar 31, 2023 · 3 comments

Comments

@jeffjg
Copy link

jeffjg commented Mar 31, 2023

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
Copy link
Contributor

kamilkrzyskow commented Apr 1, 2023

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
Copy link
Author

jeffjg commented Apr 1, 2023

You beautiful genius! Thank you, it works!

@lukasgeiter
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants