Skip to content

Checking internal links? #12

Open
Open
@fohrloop

Description

I see that in the plugins/deadlinks/deadlinks.py the internal links are explicitly skipped:

    for anchor in soup_doc(["a", "object"]):
        if "href" not in anchor.attrs:
            continue
        url = anchor["href"]

        # local files and other links are not really intresting
        if not url.startswith("http"):
            continue # <-- this part skips internal links like somepage#someanchor

        # Previous case works also for debugging environment (with SITEURL
        # being empty) This case resolves publish environment with all links
        # starting with http.
        if siteurl and url.startswith(siteurl):
            log.info("Url %s skipped because is starts with %s", url, siteurl)
            continue

Sometimes (after large refactoring, for example), it would be nice to check that internal links work, too. Basic support could just check the existence of the file. Supporting checking anchors would be even better.

Do you think the scope of the package could allow for including checks for internal links?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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