Skip to content

UX improvement for path-relocatable sites? #2195

@roberth

Description

@roberth

I maintain testers.lycheeLinkCheck in Nixpkgs. Recently I've had some trouble with mdbook sites and I noticed that if --root-dir is not passed, lychee will report errors like:

Cannot resolve root-relative link '/': To resolve root-relative links in local files, provide a root dir

That's correct, but not great for sites that need to actively avoid root-relative links.

Would you be interested in a PR that allows this intent to be declared in the options?

 --relocatable
    Declare that the site must be mountable onto any path.
    While this is the de facto default behavior, this option makes the error message explicit about the requirement.
    This is the opposite of specifying `--root-dir`; they're mutually exclusive.

New UX

  1. Instead of failing, ask the user to elaborate:
Don't know how to resolve root-relative link '/'! If your site must be relocatable to any path, pass `--relocatable` or `relocatable = true` in the configuration. Otherwise, pass `--root-dir`.
  1. Either success, or, if relocatable:
Root-relative links (starting with '/') are not allowed because this site should be relocatable to any path.

Context

I've prototyped this idea in NixOS/nixpkgs#520792 and that PR would solve the immediate problem for me, but I'd much prefer a built-in solution of course.

So

Does this match your design philosophy for lychee?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions