Skip to content

archive_url_format: "{date}" resulted in the exclusion of files from build #5904

@balansczerni

Description

@balansczerni

Context

I tried to set a short url for the build-in blog archive with archive_url_format: "{date}".

Bug description

Setting archive_url_format: "{date}" results in an error that excludes pages from the blog directory from being built by MkDocs.

mkdocs.yml:

plugins:
  - blog:
      archive_url_format: "{date}"

Files:

.
├─ docs/
│  └─ blog/
│     ├─ lorem/
│     │  └─ blog-page.md 👎
│     ├─ posts/
│     ├─ blog-page.md 👎
│     └─ index.md 👎
└─ mkdocs.yml

Error:

INFO    -  Building documentation...
INFO    -  Cleaning site directory
INFO    -  A reference to 'blog/index.md' is included in the 'nav' configuration, but this file is excluded from the built site.
INFO    -  A reference to 'blog/blog-page.md' is included in the 'nav' configuration, but this file is excluded from the built site.
INFO    -  A reference to 'blog/lorem/blog-page.md' is included in the 'nav' configuration, but this file is excluded from the built site.
INFO    -  Documentation built in 0.16 seconds

Temp. fix:

Setting archive_url_format: "a/{date}" or leaving it default ("archive/{date}").

More tests:

I was curious if this bug would affect: custom category pages or hand made yyyy.md pages.

It turned out that these pages work properly...

.
├─ docs/
│  └─ blog/
│     ├─ category/
│     │  └─ custom-category-page.md 👍
│     ├─ lorem/
│     │  └─ blog-page.md 👎
│     ├─ posts/
│     │  └─ (some posts from 2020 and 2023 with "custom-category-page" category)
│     ├─ blog-page.md 👎
│     ├─ 2023.md  👍
│     ├─ 2020.md  👍
│     └─ index.md 👎
└─ mkdocs.yml

The bug is also present in the Insiders version.

EDIT: @squidfunk I got same issue with "categories_url_format: "{slug}" btw.

Related links

Reproduction

(Contrary to the name, these reproductions are not based on the Insiders version.)

Minimal reproduction:

9.2.5+insiders.4.40.1-archive-url-turn-md-excluded.zip

Reproduction from tests (yyyy.md + category/name.md):

9.2.5+insiders.4.40.1-same-bug-but-yyyy-cat-works.zip

mkdocs                     1.5.2
mkdocs-material            9.2.5
mkdocs-material-extensions 1.1.1

Steps to reproduce

  1. Setup fresh venv.
python3 -m venv venv
. venv/bin/activate
pip install --upgrade --force-reinstall mkdocs-material
mkdocs new .
  1. Setup mkdocs.yml with blog plugin archive_url_format: "{date}" option
  2. Make some *.md's inside blog dir that do not cover dates (yyyy.md) or category names (category/name.md).
  3. Run build.

Browser

No response

Before submitting

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