Skip to content

[bug]: Page titles from mkdocs.yml lost when using tag filterΒ #257

@Tortem

Description

@Tortem

πŸ› What happened?

By using one of the filter options related to tags (exclude_tag or include_tag) the page navigation title defined in the mkdocs.yml config are lost for all pages. Instead the other options for page navigation titles are used (title field in front matter, first H1 header and file name).

This leads to different behaviors for included pages compared to the unfiltered result.

πŸ”¬ How to reproduce?

  1. Create a mkdocs.yml with a exclude_tag or include_tag configuration and page titles in the nav section like below
  2. Run mkdocs serve and inspect the navigation titles of the pages
  3. The file name is used as title
  4. Disable the file-filter-plugin
  5. The title from the nav section is used

πŸ—οΈ Code Sample / Log

site_name: test

plugins:
  file-filter:
    enabled: true
    only_doc_pages: true
    exclude_tag:
      - public

nav:
  - Config Index: index.md
  - Config Docu: docu.md
  - Config Bla: example.md

🌌 Environment (plugin version)

0.2.0

🌌 Environment (OS)

Windows

🌌 Environment (Python)

No response

🌌 Environment (MkDocs)

1.6.0

πŸ“· Screenshots

No response

πŸ“ˆ Expected behavior

Also after filtering with this plugin the navigation title from the config file should be used first before the other options

πŸ“Ž Additional context

I had a look into the code and it seems like the __get_metadata function is producing this issue. Havent figured out why, but i can look into it further and provide a fix if desired

πŸ“œ Code of Conduct

  • I agree to follow this project's Code of Conduct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions