Skip to content

Broken links for files outside zpress content sync boundary #48

@zrosenbauer

Description

@zrosenbauer

Summary

When a markdown file synced by zpress contains relative links that point to files outside the sync boundary (i.e. files not matched by any from glob in zpress.config.ts), zpress build reports them as broken links and the build fails.

Reproduction

Given this zpress.config.ts:

export default defineConfig({
  sections: [
    {
      title: "Contributing",
      prefix: "/contributing",
      collapsible: true,
      items: [
        {
          title: "Guides",
          prefix: "/contributing/guides",
          from: "contributing/guides/*.md",
        },
      ],
    },
  ],
});

And contributing/guides/getting-started.md contains:

- [`CLAUDE.md`](../../CLAUDE.md)
- [CONTRIBUTING.md](../../CONTRIBUTING.md)

And contributing/guides/developing-a-feature.md contains:

- Familiarity with relevant [standards](../README.md)

These files (CLAUDE.md, CONTRIBUTING.md, contributing/README.md) exist in the repo but are not matched by any from glob, so they are never synced into .zpress/content/. The relative links become broken after sync.

Build output

■  Found 3 broken link(s):
│
│    ✖ .zpress/content/contributing/guides/developing-a-feature.md
│        → ../README.md
│    ✖ .zpress/content/contributing/guides/getting-started.md
│        → ../../CLAUDE.md
│        → ../../CONTRIBUTING.md

Expected behavior

zpress should handle links that point outside the content boundary gracefully. Some options:

  1. Rewrite to GitHub URLs — during sync, detect relative links that resolve outside the content tree and rewrite them to the corresponding GitHub blob URL (requires knowing the repo + branch)
  2. Warn instead of error — flag these as warnings rather than broken links, since the source files do exist in the repo
  3. External link marker — allow authors to annotate links that intentionally point outside the docs site so the checker skips them

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions