backstage / mkdocs-monorepo-plugin

✚ Build multiple documentation folders in a single Mkdocs. Designed for large codebases.
https://backstage.github.io/mkdocs-monorepo-plugin/
Apache License 2.0
328 stars 74 forks source link

Merge subdirectories into the same tree? #85

Closed SoumayaMauthoorMOJ closed 2 years ago

SoumayaMauthoorMOJ commented 2 years ago

I have a repo with multiple directories with individual READMEs and mkdocs.yml e.g.:

|-core
   |-docs
      -mkdocs.yml
      |-README.md
site_name: core
nav: 
  - Networking: README.md

I have included them in my nav so that it looks like:

nav:
  - Overview: 'README.md'
  - Implementation: 'IMPLEMENTATION.md'
  - Infrastructure: 
    - Networking: '!include ./core/mkdocs.yml'
    - Metadata: '!include ./metadata/mkdocs.yml'
    - Extraction: '!include ./pipelines/mkdocs.yml'
    - Glue: '!include ./glue_database/mkdocs.yml'

This creates the following output: image

I was wondering if there was a way of merging contents into a single output tree so that the individual headers are not duplicated e.g.:

Infrastructure
  - Networking
  - Metadata
  - Extraction
  - Glue
SoumayaMauthoorMOJ commented 2 years ago

This is possible using navigation.indexes with mkdocs materials: https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#section-index-pages

vshivam commented 1 year ago

Hi @SoumayaMauthoorMOJ, might you have a sample of what your mkdocs.yml files look like now ? I am trying to achieve exactly this but unable to get the desired result. Thanks!

SoumayaMauthoorMOJ commented 1 year ago

Unfortunately I can't share the repo because it's internal but here's the relevant mkdocs section:

  features:
    - navigation.tabs
    - navigation.tabs.sticky
    - navigation.indexes

nav:
  - Home: 
    - 'README.md'
    - Architecture: 'architecture.md'
    - Deployment: 'cicd.md'
  - Components:
    - 'components/README.md'
    - Networking: '!include ./core/mkdocs.yml'
    - Metadata: '!include ./metadata/mkdocs.yml'
    - Extraction: '!include ./pipelines/mkdocs.yml'
    - Glue: '!include ./glue_database/mkdocs.yml'
  - Contributing: 
    - 'contributing/README.md'
    - Using Pulumi: contributing/using_pulumi.md

Here's a screenshot of the repo structure:

image

And here's the link to the website which is public: https://ministryofjustice.github.io/analytical-platform-data-engineering/

The sub-pages under the Components page are all merged as desired: image

Hope that helps!

vshivam commented 1 year ago

thanks so much!