question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grouping of Rest items is not working

See original GitHub issue

I’m experiencing a TypeError error with the following configuration:

.pages:

order: desc
nav:
  - 2020 Blogs:
    - ... | regex=2020[A-Z0-9a-z_-]+.md
  - 2019 Blogs:
    - ... | regex=2019[A-Z0-9a-z_-]+.md

However the following configuration is working:

order: desc
nav:
  - ... | regex=2020[A-Z0-9a-z_-]+.md

Error:

Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/mkdocs/__main__.py", line 133, in serve_command
    serve.serve(
  File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 141, in serve
    config = builder()
  File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 136, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/build.py", line 266, in build
    nav = config['plugins'].run_event('nav', nav, config=config, files=files)
  File "/usr/local/lib/python3.8/site-packages/mkdocs/plugins.py", line 94, in run_event
    result = method(item, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/plugin.py", line 45, in on_nav
    return AwesomeNavigation(nav.items, Options(**self.config), config['docs_dir'], explicit_sections).to_mkdocs()
  File "/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/navigation.py", line 43, in __init__
    self.meta = NavigationMeta(items, options, docs_dir, explicit_sections)
  File "/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/navigation.py", line 183, in __init__
    self.root = Meta.try_load_from(join_paths(root_path, self.options.filename))
  File "/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/meta.py", line 131, in try_load_from
    return Meta.load_from(path)
  File "/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/meta.py", line 175, in load_from
    nav = [MetaNavItem.from_yaml(item, path) for item in nav]
  File "/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/meta.py", line 175, in <listcomp>
    nav = [MetaNavItem.from_yaml(item, path) for item in nav]
  File "/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/meta.py", line 41, in from_yaml
    raise TypeError('Invalid nav item format {type} [{context}]'.format(type=item, context=context))
TypeError: Invalid nav item format {'2020 Blogs': ['... | regex=2020[A-Z0-9a-z_-]+.md']} [/docs/docs/.pages]

Also I’m building a custom Docker image for Material for MkDocs, to include the awesome-pages-plugin: - https://squidfunk.github.io/mkdocs-material/getting-started/ - How to add plugins to the Docker image?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
zubietacommented, Oct 6, 2021

Hi @lukasgeiter, this is something that would be pretty useful for me too. I have some docs autogenerated with openapi-codegen where the endpoints and models are all inside the same folder but it would be pretty useful to have them as sections in the nav. Moving the files into subfolders is not feasible since they contain cross links in the markdown that would need to be replaced, which is ugly and error prone.

So something like this would be pretty awesome:

nav:
  - Endpoints:
    - ... | *Api.md
  - Models:
    - ...
1reaction
lukasgeitercommented, Jan 22, 2021

I’ll see what I can do…


In the meantime, you should be able to do the following with the current version:

  1. Create folders for every year
  2. Put a .pages file with order: desc in each folder as well as on the top-level

I think this is actually a cleaner solution as it doesn’t need regex and doesn’t require you to manually list each year in nav.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grouping SharePoint REST API results
Use it in your code to group the results by DayOfWeek . getListItems('MyMeetings','?select=Title,DayOfWeek', function(items){ ...
Read more >
Working with users, groups, and items—ArcGIS REST APIs
Users and Groups are community resources that are organized under the [Community Root] resource. Content resources are modeled under the [Content Root] ...
Read more >
Update the Assigned Group on Work Order using Rest API ...
I'm struggling with the issue of updating the Assigned Group of an exiting Work Order using Rest API. I get the following error:....
Read more >
rest naming convention with group by - java - Stack Overflow
Everything work without any issue but. I'm block with naming convention. What is the best naming convention for this kind of endpoint ?...
Read more >
ArcGIS REST JS: Working with Users, Groups, Items, and ...
ArcGIS REST JS is a lightweight library authored in TypeScript that makes it ... the ArcGIS Platform's REST APIs in both modern browsers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found