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.

Build failing on site with blog - suspect due to MkDocs 1.4

See original GitHub issue

Contribution guidelines

I’ve found a bug and checked that …

  • … the problem doesn’t occur with the mkdocs or readthedocs themes
  • … the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_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

  1. 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)
  2. Enable blog
plugins:
  - blog
  1. Run mkdocs serve or mkdocs 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:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
oprypincommented, Sep 29, 2022

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.

1reaction
squidfunkcommented, Sep 29, 2022

Fixed, thanks for @oprypin! 🎉 @StarfallProjects this should also fix the problem with the repository URL.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Notes - MkDocs
Now this special-case bug was removed. Built-in "mkdocs" theme now also supports Norwegian language (#3024). Plugin-related warnings look more ...
Read more >
Read the Docs Documentation
Read the Docs simplifies software documentation by building, versioning, and hosting of your docs, automatically.
Read more >
Setting up a blog - Material for MkDocs - GitHub Pages
Material for MkDocs makes it very easy to build a blog, either as a sidecar to your documentation or standalone. Focus on your...
Read more >
Read the Docs Documentation
Generate web pages, printable PDFs, documents for e-readers (ePub), and more all from the same ... In case your builds are failing because...
Read more >
Delft University of Technology Delft Students On Software ...
Next.js, a framework to help programmers build fast and modern web ... ocean-related problems such as the impact of chemical spills or help...
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