DariuszPorowski / mkdocs-file-filter-plugin

A MkDocs plugin that lets you exclude/include docs files using globs, regexes, gitignore-style file and Markdown/FrontMatter tags metadata.
https://pypi.org/project/mkdocs-file-filter-plugin/
MIT License
8 stars 3 forks source link

[bug]: include_tag does not work #198

Closed nonsonogio closed 4 months ago

nonsonogio commented 4 months ago

🐛 What happened?

Pages are not excluded when include_tag is used - apparently only exclude_tag works

🔬 How to reproduce?

Configure as such:

theme:
  name: material

plugins:
  - file-filter:
      filter_nav: false
      metadata_property: visibility
      include_tag:
        - public

  - search
  - awesome-pages
  - ezlinks
  - tags:
      tags_file: tags.md

Create a page with this frontmatter:

visibility: public

The page will still be included in the build website.

🏗️ Code Sample / Log

No response

🌌 Environment (plugin version)

0.2.0

🌌 Environment (OS)

Linux

🌌 Environment (Python)

3.11.1

🌌 Environment (MkDocs)

1.5.3

📷 Screenshots

No response

📈 Expected behavior

Error 404 when trying to access the "private" page i.e. any page WITHOUT the visibility:public in the frontmatter

📎 Additional context

No response

📜 Code of Conduct

DariuszPorowski commented 4 months ago

Hi @nonsonogio It's expected behavior, see: https://github.com/DariuszPorowski/mkdocs-file-filter-plugin?tab=readme-ov-file#conflict-behavior

"include has higher priority over exclude"

You have to add to your config exclude_glob or exclude_regex - depends on the case. i.e.:

exclude_regex:
 - '.*\.md$'
nonsonogio commented 4 months ago

Hello Dariusz, many thanks for clarifications, I confirm it works as you say.