timvink / mkdocs-git-revision-date-localized-plugin

MkDocs plugin to add a last updated date to your site pages
https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html
MIT License
193 stars 39 forks source link

Whitelist / Negate certain excludes with a `!`? #130

Closed hudsonm62 closed 4 months ago

hudsonm62 commented 5 months ago

I'm excluding all my index.md files (as these are for the most part "home" pages), however there's one or two I want to keep the dates on.

Sometimes, you can just prefix ! to "negate" or "ignore" a file or pattern (like in a .gitignore for example). But doesn't seem to work here (assuming it's because it relies on glob??)

  - git-revision-date-localized:
      exclude:
        - "!topics/index.md" # don't exclude topics page
        # ignore all homepages
        - "index.md"
        - "**/index.md"

Not sure if this is possible already and I'm just going about it the wrong way? but would be great if I could negate certain patterns/specific files from the exclude.

timvink commented 4 months ago

Yes they are glob patterns, not regex patterns. It seems you need to look into using patterns ([ and ]):

The exclamation mark can negate a pattern that it is put in front of. In the character class example I shared above, we used the pattern [CBR]at.

https://www.malikbrowne.com/blog/a-beginners-guide-glob-patterns/