backstage / backstage/mkdocs-monorepo-plugin
Error when trying to do mkdocs serve
- Dominant language
- Python
- Stars
- 400
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
Hi everyone!
I'm currently using the latest version released of the plugin (v1.0.4) and my `mkdocs.yml` file has this line inside the navigation part.
``` yaml
nav:
- Home: index.md
- API:
- books_try1: '!include ./packages/cr_packages/cr-customer-booksuite/mkdocs.yml'
- books_tr2: '*include ./packages/cr_packages/*/mkdocs.yml'
plugins:
- monorepo
- search:
lang: en
- mkdocstrings:
```
The problem is that is not working with any of the `!include` possibilities, I always get this same error:
``` yaml
INFO - Building documentation...
INFO - Cleaning site directory
INFO - The following pages exist in the docs directory, but are not included in the "nav"
configuration:
- keep_data_updated.md
- workflow_deepdive.md
ERROR - Error reading page 'cr-customer-booksuite/index.md': 'NoneType' object has no
attribute 'endswith'
Traceback (most recent call last):
File "/opt/anaconda3/envs/c1wv2/bin/mkdocs", line 8, in
sys.exit(cli())
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs/__main__.py", line 181, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 63, in serve
config = builder()
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 58, in builder
build(config, live_server=live_server, dirty=dirty)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs/commands/build.py", line 292, in build
_populate_page(file.page, config, files, dirty)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs/commands/build.py", line 163, in _populate_page
page = config['plugins'].run_event(
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs/plugins.py", line 102, in run_event
result = method(item, **kwargs)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs_monorepo_plugin/plugin.py", line 71, in on_pre_page
set_edit_url(config, page, self)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 105, in set_edit_url
page.edit_url = edit_url.build()
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 98, in build
if self.__has_repo():
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 85, in __has_repo
page_config_file_yaml = self.__get_page_config_file_yaml()
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 82, in __get_page_config_file_yaml
return self.__load_page_config_file(f)
File "/opt/anaconda3/envs/c1wv2/lib/python3.8/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 68, in __load_page_config_file
and not page_repo_url.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
```
I was reading some ways to address this problem, and found this two issues: https://github.com/backstage/mkdocs-monorepo-plugin/issues/77 and https://github.com/backstage/mkdocs-techdocs-core/issues/62
I think they are related to this error, but other than installing the v1.0.0 version, does anyone know a different way to fix this?
Thanks a lot in advance!
Contributor guide
Research direction
Reproduce the report with the supplied mkdocs.yml and `mkdocs serve`, then inspect `mkdocs_monorepo_plugin/edit_uri.py`, especially `set_edit_url`, `build`, `__has_repo`, and `__load_page_config_file`. Confirm the behavior around `page_repo_url` and verify that the documented configuration no longer raises the reported `NoneType`/`endswith` error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100