Build failing on site with blog - suspect due to MkDocs 1.4
See original GitHub issueContribution guidelines
- I’ve read the contribution guidelines and wholeheartedly agree
I’ve found a bug and checked that …
- … the problem doesn’t occur with the
mkdocs
orreadthedocs
themes - … the problem persists when all overrides are removed, i.e.
custom_dir
,extra_javascript
andextra_css
- … the documentation does not mention anything about my problem
- … there are no open or closed issues that are related to my problem
Description
My apologies for the vague description: I think the problem is caused by some interaction between MkDocs 1.4 and the blog plugin, but can’t be sure.
Everything (including blog) was building fine 14 days ago. Today the build failed. I’d made no config changes (was just fixing a formatting typo in a blog post)
I tried going back to an older version of Insiders, as well as a couple of recent versions, but this didn’t help. It looks like the only thing that has changed in the past two weeks that might cause this is the upgrade to MkDocs 1.4.
Removing the blog setup from mkdocs.yml
got the build working again.
Expected behaviour
Site builds
Actual behaviour
Build fails with error:
ERROR - Error reading page 'blog/page/2.md': 'dict' object has no attribute 'plugins'
Traceback (most recent call last):
File "C:\Users\debor\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\debor\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\__main__.py", line 234, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\commands\serve.py", line 114, in serve
server.serve()
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\livereload\__init__.py", line 155, in serve
self._build_loop()
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\livereload\__init__.py", line 177, in _build_loop
func()
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\commands\serve.py", line 75, in builder
build(config, live_server=live_server, dirty=dirty)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\commands\build.py", line 311, in build
env = config.plugins.run_event('env', env, config=config, files=files)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\plugins.py", line 514, in run_event
result = method(item, **kwargs)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\material\plugins\blog\plugin.py", line 482, in on_env
page = self._register_page(base, config, files)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\material\plugins\blog\plugin.py", line 723, in _register_page
_populate_page(page, config, files)
File "C:\Users\debor\Desktop\starfallprojects-website\venv\lib\site-packages\mkdocs\commands\build.py", line 172, in _populate_page
page = config.plugins.run_event('pre_page', page, config=config, files=files)
AttributeError: 'dict' object has no attribute 'plugins'
Steps to reproduce
- Do a fresh install of Insiders. This can be the latest version, or an older one (I tested back to 8.5.0-insiders-4.23.4)
- Enable blog
plugins:
- blog
- Run
mkdocs serve
ormkdocs build
Package versions
- Python: tried on 3.10 (local) and 3.7 (on Cloudflare Pages)
- MkDocs: 1.4
- Material: tried with several recent Insiders, including 8.5.0-insiders-4.23.4 and latest.
Worth noting when building on Cloudflare Pages with Python 3.7 I got an additional error:
ERROR: mkdocs 1.4.0 has requirement Markdown<3.4,>=3.2.1, but you'll have markdown 3.4.1 which is incompatible.
Configuration
site_name: Starfall Projects
site_description: It's all about the words
site_author: Deborah Barnard
site_url: https://www.starfallprojects.co.uk/
theme:
name: material
icon:
logo: material/keyboard
favicon: images/favicon.png
features:
- navigation.indexes
- navigation.sections
- navigation.tabs
- navigation.tabs.sticky
- navigation.top
- navigation.tracking
language: en
plugins:
- blog:
blog_dir: blog
- search
markdown_extensions:
- attr_list
- admonition
- md_in_html
- meta
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
- pymdownx.highlight:
linenums: true
anchor_linenums: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- tables
nav:
- Home: index.md
- Blog:
- blog/index.md
System information
- Operating system: Windows 10
- Browser: N/A
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Was slightly challenging to reproduce the issue 1. I had to specify
pagination_per_page: 2
for some code to kick in. Indeed my main PR would’ve fixed it. Though I didn’t realize things could break without it.Issue 2 is separate and indeed one of the few actual breaking changes in 1.4
Now hopefully MkDocs 1.4.0 will not cause any outstanding issues.
Fixed, thanks for @oprypin! 🎉 @StarfallProjects this should also fix the problem with the repository URL.