Skip to content

fix(doc): ignore templ-broken-link issues for unavailable content#505

Merged
caugner merged 7 commits intomainfrom
452-curriculum-root-doesnt-resolve
Jan 30, 2026
Merged

fix(doc): ignore templ-broken-link issues for unavailable content#505
caugner merged 7 commits intomainfrom
452-curriculum-root-doesnt-resolve

Conversation

@caugner
Copy link
Contributor

@caugner caugner commented Jan 29, 2026

Description

Ignores templ-broken-link issues for unavailable optional content.

Also: Fixes a small bug in the function that maps curriculum paths to slug (with tests).

Motivation

Resolves an unexpected flaw: Macro ? produces link /en-US/curriculum/ which doesn't resolve

Additional details

Before

% CONTENT_ROOT=../content/files cargo run --quiet build --no-basic --issues /dev/stdout -f ../content/files/en-us/learn_web_development/core/styling_basics/overflow/index.md
Building everything 🛠️
Took:   10.301ms for reading 1 docs
Took:  692.326ms to build content docs (1)
Found 1 issues in 1 of 1 files
{
  "/path/to/mdn/content/files/en-us/learn_web_development/core/styling_basics/overflow/index.md": [
    {
      "req": 0,
      "ic": 0,
      "col": 0,
      "line": 0,
      "end_col": 0,
      "end_line": 0,
      "file": "/path/to/mdn/content/files/en-us/learn_web_development/core/styling_basics/overflow/index.md",
      "ignore": false,
      "fields": [
        [
          "source",
          "templ-broken-link"
        ],
        [
          "url",
          "/en-US/curriculum/foo"
        ]
      ],
      "spans": [
        [
          "sidebar",
          "learnsidebar"
        ],
        [
          "sidebar",
          "learnsidebar"
        ],
        [
          "slug",
          "Learn_web_development/Core/Styling_basics/Overflow"
        ],
        [
          "locale",
          "en-US"
        ],
        [
          "slug",
          "Learn_web_development/Core/Styling_basics/Overflow"
        ],
        [
          "locale",
          "en-US"
        ]
      ]
    }
  ]
}

After

% CONTENT_ROOT=../content/files cargo run --quiet build --no-basic --issues /dev/stdout -f ../content/files/en-us/learn_web_development/core/styling_basics/overflow/index.md
Building everything 🛠️
Took:   10.217ms for reading 1 docs
Took:  632.587ms to build content docs (1)
No issues found in 1 files
{}

Related issues and pull requests

Fixes #452.

@caugner caugner requested a review from a team as a code owner January 29, 2026 17:56
@caugner caugner requested a review from LeoMcA January 29, 2026 17:56
@caugner caugner changed the title fix(doc): handle curriculum link better fix(doc): ignore templ-broken-link issues for unavailable content Jan 29, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 29, 2026

c7168f9 was deployed to: https://rari-pr505.review.mdn.allizom.net/

@caugner
Copy link
Contributor Author

caugner commented Jan 29, 2026

  • main: Found 5295 issues in 1005 of 14084 files
  • this PR: Found 5294 issues in 1004 of 14084 files

Copy link
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you briefly mentioned, inverting the function would be nice for readability: otherwise looks good!

///
/// # Returns
/// `true` if the category's root is not configured; otherwise, `false`.
pub fn is_unavailable_category(category: PageCategory) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah might be good to inverse this so it's is_available_category

Copy link
Contributor Author

@caugner caugner Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in b70b1f7 (and 5c39efd), and simplified the guards in 35c028b.

@caugner caugner enabled auto-merge (squash) January 30, 2026 15:40
@caugner caugner merged commit 32943d5 into main Jan 30, 2026
17 checks passed
@caugner caugner deleted the 452-curriculum-root-doesnt-resolve branch January 30, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected flaw: Unknown macro causing a redirect that doesn't resolve

2 participants