Skip to content

Disable navigation warning #1888

Closed

Description

@adibrastegarnia

Hi,

Is it possible to disable navigation warning? I mean this message:
The following pages exist in the docs directory, but are not included in the "nav" configuration:

Activity

  1. waylan commented on Oct 20, 2019

    @waylan
    Contributor

    That is an "info" message, not a warning. The only benefit to disabling it from being displayed it that it is not displayed. In other words, it does not cause "strict" mode to fail, for example.

    Interestingly, some have requested the opposite (see #1755).

    I guess I'll consider this a request for a "quiet" option. To be clear, if we adding this option, it would disable the display of all "info" messages, not just the list of pages not included in the nav.

  2. isedwards commented on Mar 31, 2021

    @isedwards

    It would be useful to be able to mark a page as intentionally not included in the nav. When new people contribute to the docs they don't know which pages are intentionally excluded and which may have been missed by accident.

  3. NicolasMassart commented on Jul 21, 2022

    @NicolasMassart

    I'd like that as for me, the root index.md at least should not raise a warning as I don't need it in the nav...

  4. majkinetor commented on Sep 24, 2022

    @majkinetor

    I have similar warning I want to hide.

    I have bunch of files repoted as warning since one plugin keeps internal stuff in the docs structure. Its houndreeds of warnings like this:

    image

    I know about those, and it must be that way, so all this warning does is spam other output. Ideally I would be able to say that there should be no warning for path /db/*.

  5. oprypin commented on Sep 24, 2022

    @oprypin
  6. oprypin commented on Sep 24, 2022

    @oprypin
  7. majkinetor commented on Sep 24, 2022

    @majkinetor

    @oprypin , its effectivelly the same problem - warning spam. Its IMO irrevelant what is the precise reason.

    That's just the plugins fault. If you want help fixing it, you can point me to the issue.

    Its not plugins fault, its the way I use it, and it works great. In short, some pages describing the database automatically look for sql definition and txt examples in a same folder where md page is located and adds links to those files to the md page (also adding content to the md page). Except for huge amount of warnings there is absolutelly no reason to move those sql and txt files to other place.

    The warning is also incorrect and possibly even a bug - files are found among documentation.

    But I digress, the issue is warning spam, when you know the warnings are irrelevant. Majority of systems allow for disabling specific or all of the warnings.

  8. oprypin commented on Sep 24, 2022

    @oprypin
  9. majkinetor commented on Sep 24, 2022

    @majkinetor

    I am not dismissing that these warnings should be able to be silenced. I'll handle that in the upcoming months.

    That is great, thanks.

    Yes, it's a bug in the plugin. It will be there regardless if you're able to silence all warnings.

    I don't think that is the case. Plugin I use is mkdocs-macros that lets me, among other things, use python to create functions which I can use on md pages via jinja templates. This is the macro I wrote which creates this problem.

    I have 3 files X.md, X.sql, X.txt, each in the same folder inside the docs folder. The md page describes a database table and X.sql contas DDL while X.txt contains data sample.

    In main.py that macros plugin lets me use:

        @env.macro
        def inc( page, ext="sql", title="SQL" ):
            fileFullName = page.title + '.' + ext
            fileFullPath = page.file.abs_src_path.replace('.md',  f'.{ext}')
    
            try:
                with open(fileFullPath) as f:
                    lines = f.read()
            except FileNotFoundError:
                return ''
    
            return f"""
    ## {title}
    Download: [{fileFullName}](../{fileFullName})             <============ generates warnings
    ```{ext}
    {lines}
    ```   `
    """

    In X.md

    #  X
    
    ...
    
    {{ inc( page, 'sql', 'SQL') }}
    {{ inc( page, 'txt', 'Data Example') }}

    So this is mkdocs that warns me about this, not the plugin, so handling warning should help as far as I can see.

  10. redtide commented on Apr 16, 2023

    @redtide

    My only problem with this is that some files are not linked from nav, like the contacts page is linked in the footer and posts in a blog are handled by the plugin, I don't want to have a flood of lots files not in nav because they simply shouldn't be there.
    So, if I don't miss something, would be nice to have a "not_in_nav" setting that can be configured with both files and directories (glob), like "the files in this list and these directories are known to be handled somewhere else".

  11. oprypin commented on May 17, 2023

    @oprypin
  12. majkinetor commented on Jun 11, 2023

    @majkinetor

    @oprypin , while this probably helps with the warning, it is because files are now not built at all? Or am I missing something?

    In my case, I do build files, they are just not in nav, and since I have lots of them not in nav, I have lots of warnings. So the issue is warning for the files to be built, not the exlusions of such files.

  13. oprypin commented on Jun 11, 2023

    @oprypin
  14. majkinetor commented on Jun 11, 2023

    @majkinetor

    Thats it.

    Cheers @oprypin for your work. 🍾

  15. michal2612 commented on Oct 12, 2024

    @michal2612

    I had similar issue. If you have many pages that you don't include in nav section I created a simple plugin to exclude all .md files that are not mentioned in nav section.

    https://pypi.org/project/mkdocs-exclude-unused/

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions