Closed lin-ycv closed 2 years ago
I can't see any mistakes in your code, could you share a repo that reproduces the issue?
Be aware that the filtering inside a .pages
file only works with all items on that "level" (in that folder essentially). I'm working on a new version that would remove this limitation, but until then you have 3 options:
.pages
file in every relevant foldernav
attribute in mkdocs.yml
instead (same syntax, but it filters the whole tree)@lukasgeiter this would be a reppo that reproduces the issue:
https://github.com/lin-ycv/awesome-pages-test
as you can see, this page is in the nav bar
https://lin-ycv.github.io/awesome-pages-test/Rh/Gr/h_Un%20Cl/
even tho it starts with h
and I've configured .pages
to exclude it here:
https://github.com/lin-ycv/awesome-pages-test/blob/main/docs/.pages
- (once you get it working) add the
.pages
file in every relevant folder- Use the
nav
attribute inmkdocs.yml
instead (same syntax, but it filters the whole tree)
Tried these 2 options, they didn't work either, can't test the 3rd option since I'd prefer the pages to be built
Thanks for the repo. This regex should work:
nav:
- ... | regex=^[^h]
Side note: The None
in the navigation is because your index.md
has an empty title
annotation.
Thanks, that regex does work.
I'm trying to exclude all pages that starts with 'h' from showing in the nav, but i'm not successful in my attempts
my docs dir structure looks like this
in
.pages
i configured it according to https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/issues/34#issuecomment-788704657which didn't work.
I tried to change it so that only files starting with lowercase alphabets will show (just for testing)
but this gave me
none
for the nav bar insteadAll my file and folder names start with capitals, expect index and the file I want to exclude
I also tried to use the code in the comment as is
and renamed
h_File3.md
totemplate.md
, but the file still shows up on the navI'm using Material for MkDocs on GH pages, here's my settings:
mkdocs.yml
``` theme: name: material custom_dir: overrides # 404 page static_templates: - 404.html # Necessary for search to work properly include_search_page: false search_index_only: true # Default values, taken from mkdocs_theme.yml language: en font: text: Noto Sans code: Source Code Pro favicon: assets/images/favicon.png icon: logo: icon/signature palette: # Light mode - media: "(prefers-color-scheme: light)" scheme: default primary: white accent: pink toggle: icon: material/weather-sunny name: Switch to dark mode # Dark mode - media: "(prefers-color-scheme: dark)" scheme: slate primary: black accent: light green toggle: icon: material/weather-night name: Switch to light mode features: - navigation.indexes - navigation.tabs - navigation.tracking - content.code.annotate - navigation.top - search.suggest - search.highlight - search.share markdown_extensions: - attr_list - md_in_html - admonition - def_list - pymdownx.tasklist: custom_checkbox: true - pymdownx.details - pymdownx.highlight: anchor_linenums: true - pymdownx.inlinehilite - pymdownx.snippets - pymdownx.superfences - pymdownx.emoji: emoji_index: !!python/name:materialx.emoji.twemoji emoji_generator: !!python/name:materialx.emoji.to_svg options: custom_icons: - overrides/.icons - toc: permalink: true - tables - meta plugins: - search - awesome-pages extra: generator: false extra_css: - assets/css/util.css ```deploy action
``` name: action on: push: branches: - master - main jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v2 with: python-version: 3.x - run: pip install mkdocs-material - run: pip install mkdocs-awesome-pages-plugin - run: mkdocs gh-deploy --force ```The contents of the file I want to exclude looks like this (if it matters)
Anyone has any ideas on what I'm doing wrong?