squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
20.87k stars 3.53k forks source link

Social plugin crashes when font autoloading is disabled #7118

Closed joserebelo closed 6 months ago

joserebelo commented 6 months ago

Context

Updated from v9.5.18 to v9.5.19

Bug description

The social plugin now fails when font autoloading is disabled:

Traceback (most recent call last):
  File "/storage/workspace/Freeyourgadget/website/.venv/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/__main__.py", line 284, in build_command
    build.build(cfg, dirty=not clean)
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/commands/build.py", line 265, in build
    config = config.plugins.on_config(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 587, in on_config
    return self.run_event('config', config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/mkdocs/plugins.py", line 566, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 160, in on_config
    self.font = self._load_font(config)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/storage/workspace/Freeyourgadget/website/.venv/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 452, in _load_font
    name = config.theme.get("font", {}).get("text", "Roboto")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'bool' object has no attribute 'get'

Related links

Reproduction

site_name: My Docs

theme:
  name: material
  font: false

plugins:
  - social

Steps to reproduce

  1. Use the social plugin
  2. Set font: false in the theme configuration
  3. Notice the build fails

Browser

No response

Before submitting

squidfunk commented 6 months ago

Thanks for reporting. Indeed, this seems to be a regression. Note that this does not happen in Insiders, only in the communiy edition. We'll look into it.

squidfunk commented 6 months ago

Released as part of 9.5.20.