-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open
Description
Contribution 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
mkdocsorreadthedocsthemes - ... the problem persists when all overrides are removed, i.e.
custom_dir,extra_javascriptandextra_css - ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
When I attempt to build my site, I get the following error
$ python3 -m mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/homebrew/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/mkdocs/__main__.py", line 301, in <module>
cli()
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/mkdocs/__main__.py", line 234, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 82, in serve
builder(config)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 75, in builder
build(config, live_server=live_server, dirty=dirty)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/mkdocs/commands/build.py", line 320, in build
_build_theme_template(template, env, files, config, nav)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/mkdocs/commands/build.py", line 118, in _build_theme_template
output = _build_template(template_name, template, files, config, nav)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/mkdocs/commands/build.py", line 97, in _build_template
output = template.render(context)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/material/404.html", line 4, in top-level template code
{% extends "main.html" %}
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/material/main.html", line 4, in top-level template code
{% extends "base.html" %}
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/material/base.html", line 211, in top-level template code
{% include "partials/consent.html" %}
File "/Users/bgorman/GormAnalysis Dropbox/Ben Gorman/Projects/Python/material-broken/venv/lib/python3.10/site-packages/material/partials/consent.html", line 10, in top-level template code
{% if "github.com" in config.repo_url %}
TypeError: argument of type 'NoneType' is not iterable
The error is due to Jinja's in operator being used with a None value inside consent.html. Specifically, this line
{% if "github.com" in config.repo_url %}
TypeError: argument of type 'NoneType' is not iterable
If these conditions are present, you should be able to reproduce this:
- mkdocs 1.4.0,
- material 8.5.3+insiders.4.24.0
consentpresent inmkdocs.ymlrepo_urlnot present inmkdocs.yml
Strangely, this only occurred when I upgraded to mkdocs 1.4.0.
Expected behaviour
Site should build without error.
Actual behaviour
See the error above.
Steps to reproduce
I've published an example repo you can clone to reproduce this error.
git clone https://github.com/ben519/material-broken.git
cd material-broken
export GH_TOKEN=XYZToken
python3 -m pip install mkdocs git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git --upgrade
python3 -m mkdocs serve
Package versions
Python 3.10.6
mkdocs, version 1.4.0
Version: 8.5.3+insiders.4.24.0
Configuration
site_name: ABC
# repo_url: https://github.com/squidfunk/mkdocs-material # uncomment this line and the build works
theme:
name: material
extra:
consent:
title: Cookie consent
description: hello world
nav:
- Home: index.md
- Dogs:
- dogs/index.md
- Golden Retrievers:
- Golden Retrievers: dogs/golden-retrievers/index.md
- Movies: dogs/golden-retrievers/movies.mdSystem information
Mac OS 12.6
Chrome Version 105.0.5195.125 (Official Build) (arm64)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open