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

Section index pages seems not work #3361

Closed
5 tasks done
aborruso opened this issue Dec 18, 2021 · 12 comments
Closed
5 tasks done

Section index pages seems not work #3361

aborruso opened this issue Dec 18, 2021 · 12 comments

Comments

@aborruso
Copy link
Contributor

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

I have set these features here:

  features:
    - navigation.top
    - navigation.tabs
    - navigation.sections
    - search.highlight
    - search.share
    - search.suggest
    - navigation.tracking

And this is my navigation:

nav:
    - Home: README.md
    - Guida:
      - Introduzione: introduzione/README.md
      - Formato di dati tabellari: formato_dati_tabellari/README.md
      - Dizionario: dizionario_dati/README.md
      - Linee guida pubblicazione:
          - linee_guida_pubblicazione_file/index.md
          - Singola riga intestazione: linee_guida_pubblicazione_file/P01_unica_riga_intestazione.md
    - Partecipa: partecipa.md
    - Note: note_redazione.md

Why Linee guida pubblicazione is not linked to the section index file, and I have the index file below the section name in the tree?

image

Expected behaviour

To have the section in tree linked to index file

Actual behaviour

The section is not linked to the index file

Steps to reproduce

I have inserted all my source file.

This is the repo https://github.com/ondata/guidaPraticaPubblicazioneCSV

Package versions

  • Python: python --version 3.9.2
  • MkDocs: mkdocs --version 1.2.3
  • Material: pip show mkdocs-material | grep -E ^Version 8.1.0

Configuration

site_name: Guida per la pubblicazione di CSV
site_url:  https://ondata.github.io/guidaPraticaPubblicazioneCSV/
site_description: Guida pratica per la pubblicazione di dati tabellari in formato CSV


repo_url: https://github.com/ondata/guidaPraticaPubblicazioneCSV
repo_name: guidaPubblicazioneCSV
edit_uri: edit/main/docs/

copyright: 'Questa guida è un progetto dell''<a href="https://twitter.com/ondatait" target="_blank">associazione onData</a> | licenza <a href="https://creativecommons.org/licenses/by-sa/4.0/deed.it" target="_blank">CC BY-SA 4.0</a>'

theme:
  name: material
  icon:
    logo: material/table
  highlightjs: true
  custom_dir: overrides
  favicon: imgs/favicon.ico
  palette:
    - scheme: preference
      primary: deep purple
      accent: orange
      toggle:
        icon: material/weather-night
        name: Switch to dark mode
    - scheme: slate
      primary: deep purple
      accent: orange
      toggle:
        icon: material/weather-sunny
        name: Switch to light mode
  language: it
  features:
    - navigation.top
    - navigation.tabs
    - navigation.sections
    - search.highlight
    - search.share
    - search.suggest
    - navigation.tracking
  font:
    text: Montserrat
    #code: Cutive Mono
    code: Fira Code


nav:
    - Home: README.md
    - Guida:
      - Introduzione: introduzione/README.md
      - Formato di dati tabellari: formato_dati_tabellari/README.md
      - Dizionario: dizionario_dati/README.md
      - Linee guida pubblicazione:
          - linee_guida_pubblicazione_file/index.md
          - Singola riga intestazione: linee_guida_pubblicazione_file/P01_unica_riga_intestazione.md
    - Partecipa: partecipa.md
    - Note: note_redazione.md

extra:
 social:
    - icon: fontawesome/brands/twitter
      link: https://twitter.com/ondatait

# foglio di stile personalizzato
extra_css:
  - stylesheets/style.css

plugins:
  - search:
      lang: it
  - mkdocstrings
  - mermaid2

extra_javascript:
  - https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js
  - javascripts/tables.js
  - javascripts/varie.js
  - https://unpkg.com/mermaid/dist/mermaid.min.js

markdown_extensions:
- admonition
- md_in_html
- attr_list
- footnotes
- meta
- mkdocs-click
- pymdownx.keys
- pymdownx.betterem:
      smart_enable: all
- pymdownx.caret
- pymdownx.critic:
      mode: view
- pymdownx.details
- pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
- pymdownx.highlight
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:mermaid2.fence_mermaid
- pymdownx.tabbed
- pymdownx.tasklist:
      custom_checkbox: true
      clickable_checkbox: true
- pymdownx.tilde
- toc:
      permalink: true
      toc_depth: 3


### System information

- Operating system:  win10
- Browser: Version 96.0.4664.110 (Official Build) (64-bit)
@squidfunk
Copy link
Owner

You need to enable navigation.indexes alongside navigation.sections, as those are two separate features (that work together).

@aborruso
Copy link
Contributor Author

You need to enable navigation.indexes alongside navigation.sections, as those are two separate features (that work together).

Thank you very much, but please be patient, there is something more that I do not understand.

If I add navigation.indexes to this feature

  features:
    - navigation.top
    - navigation.tabs
    - navigation.sections
    - navigation.expand
    - search.highlight
    - search.share
    - search.suggest
    - navigation.tracking

all subsections disappear. How to have both index pages and sections?

image

@squidfunk squidfunk reopened this Dec 18, 2021
@squidfunk
Copy link
Owner

Material for MkDocs only supports a single index.md (or README.md which is the same for MkDocs). If you rename the files of those pages they will reappear.

@aborruso
Copy link
Contributor Author

Material for MkDocs only supports a single index.md (or README.md which is the same for MkDocs).

Thank you very much. Where can I read about it?

If you rename the files of those pages they will reappear.

I have renamed all file. This is my new nav:

nav:
    - Home: index.md
    - Guida:
      - guida/introduzione.md
      - Formato di dati tabellari: guida/formato_dati_tabellari.md
      - Dizionario: guida/dizionario_dati.md
      - Linee guida pubblicazione:
          - guida/linee_guida_pubblicazione.md
          - Singola riga intestazione: guida/P01_unica_riga_intestazione.md
    - Partecipa: partecipa.md
    - Note: note_redazione.md

These my features:

  features:
    - navigation.indexes
    - navigation.sections
    - navigation.tabs
    - navigation.top
    - navigation.tracking
    - search.highlight
    - search.share
    - search.suggest

But my two sections are not linked to any document.

image

@aborruso
Copy link
Contributor Author

Material for MkDocs only supports a single index.md (or README.md which is the same for MkDocs).

I finally understood and solved: you cannot have two index files at the same hierarchical level of navigation, but you can have multiple index files,

Probably I will propose you some PR in your great documentation site.

Thank you

aborruso added a commit to aborruso/mkdocs-material that referenced this issue Dec 19, 2021
Related to:

> Material for MkDocs only supports a single index.md (or README.md which is the same for MkDocs). If you rename the files of those pages they will reappear.

squidfunk#3361 (comment)
@squidfunk
Copy link
Owner

f3926bf fixes the issue. Subsequent index.md or README.md files are now included in the navigation.

@aborruso
Copy link
Contributor Author

f3926bf fixes the issue. Subsequent index.md or README.md files are now included in the navigation.

I felt stupid. Glad to have been useful, I was a little crazy with a thousand tries

Thank you

@squidfunk
Copy link
Owner

No worries! The navigation template is very complex, which is why I didn't consider fixing this case in the first place, but sometimes a second look with fresh eyes reveals a solution that is much simpler than everything considered before 😉

@squidfunk
Copy link
Owner

Released as part of 8.1.3.

@pawamoy
Copy link
Contributor

pawamoy commented Dec 30, 2021

That seems to break the integration with mkdocs-section-index, /cc @oprypin.

With mkdocs-section-index 0.3.2, released Oct. 2, and

  • mkdocs-material 8.1.2: links are appearing as expected
  • mkdocs-material 8.1.3: the links under a section index disappear

image

image

Snippets of my setup:

$ tree docs/                                                                                                                                                                                            
docs/
├── index.md
└── reference
    ├── testing
    │   ├── examples.md
    │   ├── index.md
    │   └── models.md
    └── SUMMARY.md

SUMMARY.md

* [testing](testing/index.md)
    * [examples](testing/examples.md)
    * [models](testing/models.md)
# mkdocs.yml (minimum contents)

nav:
- Home:
  - Overview: index.md
- Code Reference: reference/

theme:
  name: material
  features:
  - navigation.tabs
  - navigation.top

markdown_extensions:
- toc

plugins:
- search
- literate-nav:
    nav_file: SUMMARY.md
- section-index

@oprypin
Copy link
Contributor

oprypin commented Dec 30, 2021

@pawamoy Yes, this broke that in a way that was hard to notice.
But, it's tracked as oprypin/mkdocs-section-index#10 - can't really say something is faulty here. So it's not useful to bring up here, unless as part of a (repeat) proposal to not force that plugin to hack into the template. #2060

@pawamoy
Copy link
Contributor

pawamoy commented Dec 30, 2021

Ah, apologies to you both for not checking mkdocs-section-index's issue tracker! Thanks @oprypin

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

4 participants