Skip to content

Auto-import entire external docs/ directory via nav_repos without a mkdocs.yml file #172

Open
@sujeet01

Description

@sujeet01

I'm using this plugin with the nav_repos configuration to maintain a custom navigation order in my central documentation site. My goal is to have the entire docs/ directory from external repositories (including all subdirectories and files) auto-populated under a "Components" section in my navigation without manually listing each file.

Here's my current configuration:

plugins:
  - search
  - multirepo:
      nav_repos:
        - name: repo1
          import_url: 'https://github.com/repo1?branch=main'
          imports: [
            docs/*
          ]
        - name: repo2 ...
          
nav:
  - Home: index.md
  - Components:
      - Repo1: repo1/docs/README.md   # How can I populate the entire docs directory automatically here?
          - Home: repo1/docs/README.md
          - Page1: repo1/docs/folder1/page1.md
          - Page2: repo1/docs/folder2/page2.md
      - Repo2: ...
  - Other sections from root docs
  ...

When I try to use a direct !import statement in the nav, I get the following error because my external repository does not include a mkdocs.yml file:

mkdocs_multirepo_plugin.util.ImportDocsException: components/repo1 doesn't have mkdocs.yml at /docs/temp_dir/components/repo1/mkdocs.yml

I need a way to auto-import all subdirectories from the external repo's docs/ folder without having to list them manually, while preserving the order of my other nav sections. Is there a supported configuration or workaround to achieve this using nav_repos, given that my external repos don't have their own mkdocs.yml file?

Thank you for your assistance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions