8000 [insider] blog post plugin does not include templates · Issue #4345 · squidfunk/mkdocs-material · GitHub
[go: up one dir, main page]

Skip to content
[insider] blog post plugin does not include templates #4345
@vwxyzjn

Description

@vwxyzjn

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

I was trying to use the blog plugin and set up the directory according to https://squidfunk.github.io/mkdocs-material/blog/2022/09/12/blog-support-just-landed/, but mkdocs serve error out

.
├── docs
│   ├── index.md
│   └── posts
│       └── hello-world.md
└── mkdocs.yml

Expected behaviour

The blog post example should work.

Actual behaviour

When running the insider, I got the following error:

  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/mkdocs/__main__.py", line 181, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 63, in serve
    config = builder()
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 58, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/mkdocs/commands/build.py", line 282, in build
    files = config['plugins'].run_event('files', files, config=config)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/mkdocs/plugins.py", line 102, in run_event
    result = method(item, **kwargs)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/material/plugins/blog/plugin.py", line 270, in on_files
    data = self._generate_files_for_archive(config, files)
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/material/plugins/blog/plugin.py", line 552, in _generate_files_for_archive
    self._generate_file(path, "blog-archive", name),
  File "/home/costa/.cache/pypoetry/virtualenvs/cleanrl-ghSZGHE3-py3.9/lib/python3.9/site-packages/material/plugins/blog/plugin.py", line 673, in _generate_file
    os.path.join(
  File "/home/costa/.pyenv/versions/3.9.5/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

The relevant code is

        if "template" not in page.meta:
            page.meta["template"] = os.path.normpath(
                os.path.join(
                    self.config.get("blog_custom_dir", "."),
                    "blog-post.html"
                )
            )

so it looks like the insider is not finding blog_custom_dir's blog-post.html properly.

Steps to reproduce

Follow https://squidfunk.github.io/mkdocs-material/blog/2022/09/12/blog-support-just-landed/.

Package versions

  • Python: python --version: Python 3.9.5
  • MkDocs: mkdocs --version: mkdocs, version 1.3.1
  • Material: pip show mkdocs-material | grep -E ^Version: this command does not work. I installed via pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git.

Configuration

site_name: My Blog
theme:
  name: material
  features:
    - navigation.sections
plugins:
  - blog:
      blog_dir: . 
  - search
  - tags
nav:
  - index.md

System information

  • Operating system: linux
  • Browser: chome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0