Skip to content

[Doc][improve] Auto-detect broken links and integrate into CI process #18026

Closed
apache/pulsar-site
#368

Description

@labuladong

Search before asking

  • I searched in the issues and found nothing similar.

What issue do you find in Pulsar docs?

After #17495 and #17599, we can see many broken links in the Pulsar document. And more links may break during further evolution.

What is your suggestion?

In #17599 I use a script but it's not reliable enough so I have to check the links list manually. I suggest developing a reliable script to auto-detect the incorrect links in the Pulsar document. Maybe we can integrate this script into the CI process which is related to document change.

Before development, I'd like to enumerate all kinds of broken links.

1. wrong markdown file reference

For example the link of this page:

image

The markdown content is [configuration](reference-configuration.md), but the reference-configuration.md file not exists.

2. 404 URL path

For example the link of this page:

image

The markdown content is [type](/api/client/index.html?org/apache/pulsar/client/api/CompressionType.html), but the Pulsar site doesn't have this path.

3. confusing URL path

For example the link of this page:

image

The markdown content is [Pulsar Functions CLI](/tools/pulsar-admin/), but this refers to a confusing page:

image

4. invalid title anchor

We can use # to refer to a specific block of HTML this way: [dataDir](reference-configuration.md#zookeeper-dataDir). So if our script can detect the anchor will be better.

Our script should be able to detect these broken links and print warning messages to users.

cc @tisonkun @Anonymitaet @momo-jun @michaeljmarshall

Any reference?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    doc-required
    on Oct 13, 2022
  2. tisonkun commented on Oct 13, 2022

    @tisonkun
    Member

    Since we build some pages on the fly instead of all content static, we may need an external sensor/crawler for the online version, or static check after the site was built.

    Related issue: #18014

  3. Anonymitaet commented on Oct 13, 2022

    @Anonymitaet
    Member
  4. labuladong commented on Oct 13, 2022

    @labuladong
    ContributorAuthor

    #18014 Looks great, but it seems like a big change. If we build the site dynamically, I think detecting the generated HTML files may be better than the external crawler.

    Before #18014 finishes, I think 1. wrong markdown file reference and 4. invalid title anchors are still worth detecting.

  5. tisonkun commented on Oct 13, 2022

    @tisonkun
    Member

    For external tools, normally we use https://www.drlinkcheck.com/ to check URLs.

    It helps detect this issue apache/pulsar-site#252, PTAL.

  6. labuladong commented on Oct 19, 2022

    @labuladong
    ContributorAuthor

    The detect script see here. PR #18109 fix almost all invalid title anchors. But there are still many invalid markdown file references about reference-configuration.md:

    administration-pulsar-shell.md has 1 errors:

    [pulsar-client](reference-cli-tools#pulsar-client.md) -> reference-cli-tools#pulsar-client.md not exist
    

    administration-geo.md has 2 errors:

    [per-tenant basis](#concepts-multi-tenancy) -> administration-geo.md doesn't have anchor: #concepts-multi-tenancy
    [broker configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    security-athenz.md has 1 errors:

    [Broker Configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    client-libraries-websocket.md has 6 errors:

    [`webSocketServiceEnabled`](reference-configuration.md#broker-webSocketServiceEnabled) -> reference-configuration.md not exist
    [`conf/broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`conf/websocket.conf`](reference-configuration.md#websocket) -> reference-configuration.md not exist
    [`configurationMetadataStoreUrl`](reference-configuration.md#websocket) -> reference-configuration.md not exist
    [`webServicePort`](reference-configuration.md#websocket-webServicePort) -> reference-configuration.md not exist
    [`clusterName`](reference-configuration.md#websocket-clusterName) -> reference-configuration.md not exist
    

    security-authorization.md has 4 errors:

    [`conf/broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [Broker Configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`conf/broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`conf/broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    cookbooks-non-persistent.md has 3 errors:

    [`enableNonPersistentTopics`](reference-configuration.md#broker-enableNonPersistentTopics) -> reference-configuration.md not exist
    [`standalone.conf`](reference-configuration.md#standalone) -> reference-configuration.md not exist
    [`enablePersistentTopics`](reference-configuration.md#broker-enablePersistentTopics) -> reference-configuration.md not exist
    

    security-tls-authentication.md has 1 errors:

    [the configuration to enable TLS encryption](security-tls-transport.md#configure-tls-encryption-in-cli-tools) -> security-tls-transport.md doesn't have anchor: #configure-tls-encryption-in-cli-tools
    

    administration-zk-bk.md has 7 errors:

    [`conf/zookeeper.conf`](reference-configuration.md#zookeeper) -> reference-configuration.md not exist
    [`dataDir`](reference-configuration.md#zookeeper-dataDir) -> reference-configuration.md not exist
    [`conf/global_zookeeper.conf`](reference-configuration.md#configuration-store) -> reference-configuration.md not exist
    [parameters](reference-configuration.md#zookeeper) -> reference-configuration.md not exist
    [`metadataStoreBatchingEnabled`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`conf/bookkeeper.conf`](reference-configuration.md#bookkeeper) -> reference-configuration.md not exist
    [`zkServers`](reference-configuration.md#bookkeeper-zkServers) -> reference-configuration.md not exist
    

    client-libraries-node.md has 1 errors:

    [these instructions](client-libraries-cpp.md#compilation) -> client-libraries-cpp.md doesn't have anchor: #compilation
    

    admin-api-tenants.md has 1 errors:

    [configuration](reference-configuration.md) -> reference-configuration.md not exist
    

    developing-binary-protocol.md has 5 errors:

    [`BaseCommand`](#pulsar.proto.BaseCommand) -> developing-binary-protocol.md doesn't have anchor: #pulsar.proto.BaseCommand
    [`Type`](#pulsar.proto.Type) -> developing-binary-protocol.md doesn't have anchor: #pulsar.proto.Type
    [`brokerEntryMetadataInterceptors`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`brokerEntryMetadataInterceptors`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`exposingBrokerEntryMetadataToClientEnabled`](reference-configuration-broker.md#exposingbrokerentrymetadatatoclientenabled) -> reference-configuration-broker.md not exist
    

    concepts-multiple-advertised-listeners.md has 1 errors:

    [broker configuration file](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    admin-api-clusters.md has 1 errors:

    [configuration](reference-configuration.md) -> reference-configuration.md not exist
    

    concepts-architecture-overview.md has 2 errors:

    [non-persistent](concepts-messaging.md#non-persistent-topics.md) -> concepts-messaging.md doesn't have anchor: #non-persistent-topics.md
    [`journalMaxSizeMB`](reference-configuration.md#bookkeeper) -> reference-configuration.md not exist
    

    admin-api-brokers.md has 3 errors:

    [Configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    [configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`brokerShutdownTimeoutMs`](reference-configuration.md#broker-brokerShutdownTimeoutMs) -> reference-configuration.md not exist
    

    administration-proxy.md has 1 errors:

    [Pulsar proxy](reference-configuration.md#pulsar-proxy) -> reference-configuration.md not exist
    

    cookbooks-retention-expiry.md has 1 errors:

    [`broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    deploy-bare-metal.md has 11 errors:

    [broker configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    [ZooKeeper configuration](reference-configuration.md#zookeeper) -> reference-configuration.md not exist
    [`conf/zookeeper.conf`](reference-configuration.md#zookeeper) -> reference-configuration.md not exist
    [`dataDir`](reference-configuration.md#zookeeper-dataDir) -> reference-configuration.md not exist
    [`conf/bookkeeper.conf`](reference-configuration.md#bookkeeper) -> reference-configuration.md not exist
    [`zkServers`](reference-configuration.md#bookkeeper-zkServers) -> reference-configuration.md not exist
    [here](reference-configuration.md#bookkeeper) -> reference-configuration.md not exist
    [`metadataStoreUrl`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`configurationMetadataStoreUrl`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`conf/broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`conf/client.conf`](reference-configuration.md#client) -> reference-configuration.md not exist
    

    reference-metrics.md has 4 errors:

    [Request metrics](#request-metrics) -> reference-metrics.md doesn't have anchor: #request-metrics
    [Server metrics](#server-metrics-1) -> reference-metrics.md doesn't have anchor: #server-metrics-1
    [Replication metrics](#replication-metrics-1) -> reference-metrics.md doesn't have anchor: #replication-metrics-1
    [Connection metrics](#connection-metrics) -> reference-metrics.md doesn't have anchor: #connection-metrics
    

    functions-concepts.md has 1 errors:

    [cluster-mode](functions-deploy.md#depoy-a-function-in-cluster-mode) -> functions-deploy.md doesn't have anchor: #depoy-a-function-in-cluster-mode
    

    client-libraries-java.md has 3 errors:

    [above](#client-configuration) -> client-libraries-java.md doesn't have anchor: #client-configuration
    [partitioned topics](concepts-architecture-overview.md#partitioned-topics) -> concepts-architecture-overview.md doesn't have anchor: #partitioned-topics
    [above](#client-configuration) -> client-libraries-java.md doesn't have anchor: #client-configuration
    

    concepts-messaging.md has 2 errors:

    [configure](reference-configuration.md#broker) -> reference-configuration.md not exist
    [configuration](reference-configuration.md#broker-enableNonPersistentTopics) -> reference-configuration.md not exist
    

    admin-api-overview.md has 1 errors:

    [`conf/client.conf`](reference-configuration.md#client) -> reference-configuration.md not exist
    

    cookbooks-deduplication.md has 1 errors:

    [`broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    develop-schema.md has 1 errors:

    [`broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    reference-pulsar-admin.md has 2 errors:

    [here](reference-configuration.md#broker) -> reference-configuration.md not exist
    [here](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    cookbooks-compaction.md has 1 errors:

    [broker configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    admin-api-topics.md has 2 errors:

    [here](reference-configuration.md#broker) -> reference-configuration.md not exist
    [here](reference-configuration.md#broker) -> reference-configuration.md not exist
    

    deploy-bare-metal-multi-cluster.md has 14 errors:

    [broker configuration](reference-configuration.md#broker) -> reference-configuration.md not exist
    [ZooKeeper configuration](reference-configuration.md#zookeeper) -> reference-configuration.md not exist
    [`conf/zookeeper.conf`](reference-configuration.md#zookeeper) -> reference-configuration.md not exist
    [`dataDir`](reference-configuration.md#zookeeper-dataDir) -> reference-configuration.md not exist
    [`conf/global_zookeeper.conf`](reference-configuration.md#configuration-store) -> reference-configuration.md not exist
    [`conf/bookkeeper.conf`](reference-configuration.md#bookkeeper) -> reference-configuration.md not exist
    [`zkServers`](reference-configuration.md#bookkeeper-zkServers) -> reference-configuration.md not exist
    [`conf/broker.conf`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`metadataStoreUrl`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`configurationMetadataStoreUrl`](reference-configuration.md#broker) -> reference-configuration.md not exist
    [`clusterName`](reference-configuration.md#broker-clusterName) -> reference-configuration.md not exist
    [endpoint](reference-configuration.md) -> reference-configuration.md not exist
    [`conf/client.conf`](reference-configuration.md#client) -> reference-configuration.md not exist
    [`serviceUrl`](reference-configuration.md#client-serviceUrl) -> reference-configuration.md not exist
    

    reference-cli-pulsar-shell.md has 1 errors:

    [pulsar-client](#pulsar-client) -> reference-cli-pulsar-shell.md doesn't have anchor: #pulsar-client
    
  7. tisonkun commented on Oct 19, 2022

    @tisonkun
    Member

    @Anonymitaet Then we should properly redirect or update the links. Or host the deprecated tools content on an archived source (and properly redirect there).

  8. labuladong commented on Oct 21, 2022

    @labuladong
    ContributorAuthor

    @Anonymitaet So I think we can replace all reference-configuration.md with https://pulsar.apache.org/reference. Right?

  9. tisonkun commented on Oct 21, 2022

    @tisonkun
    Member

    @labuladong not exactly. You may be aware that https://pulsar.apache.org/reference doesn't contain all versions of references. So it's a bit tricky if you globally do the replacement (apply for all versions), you actually cause new issues.

  10. labuladong commented on Oct 21, 2022

    @labuladong
    ContributorAuthor

    OK. But all the reference-configuration.md is 404... I think we should do something to optimize it.

  11. tisonkun commented on Oct 21, 2022

    @tisonkun
    Member

    @labuladong at least for the maintained versions (2.10.x, 2.9.x, 2.8.x, 2.7.x) you can do the replacement. My comments above hint that it can not be applied simply globally - you should check the result instead of making assumptions.

  12. Anonymitaet commented on Oct 21, 2022

    @Anonymitaet
    Member

    @labuladong not exactly. You may be aware that https://pulsar.apache.org/reference doesn't contain all versions of references. So it's a bit tricky if you globally do the replacement (apply for all versions), you actually cause new issues.

    Exactly

  13. Anonymitaet commented on Oct 21, 2022

    @Anonymitaet
    Member

    OK. But all the reference-configuration.md is 404... I think we should do something to optimize it.

    FYI: https://github.com/apache/pulsar/pull/18132/files#diff-2f6afd23b9f4fddf8ea934eb85c62599f7d05e01bb457cbabc2a178cd92ddab9 is adding reference-configuration.md back

    CC @SignorMercurio

  14. tisonkun commented on Oct 21, 2022

    @tisonkun
    Member

    @Anonymitaet one comment here is about #17438. Otherwise, when a release note refers to the latest stable version, it can only use /docs/path/to/page instead of a stable /docs/version/path/to/page. If we later make some refactors for the next version and after the next stable version is released, those links can be broken. Even we don't break the link, when the next stable version is released, the target of the link is semantically wrong.

    For example, [Kafka Connector](https://pulsar.apache.org/docs/en/io-kafka/) in this page links to a removed page.

  15. Anonymitaet commented on Oct 21, 2022

    @Anonymitaet
    Member

    @Anonymitaet one comment here is about #17438. Otherwise, when a release note refers to the latest stable version, it can only use /docs/path/to/page instead of a stable /docs/version/path/to/page. If we later make some refactors for the next version and after the next stable version is released, those links can be broken. Even we don't break the link, when the next stable version is released, the target of the link is semantically wrong.

    For example, [Kafka Connector](https://pulsar.apache.org/docs/en/io-kafka/) in this page links to a removed page.

    Thanks! Release notes might not be affected because all release notes have specific versions. The data is pulled from https://github.com/apache/pulsar-site/tree/main/site2/website-next/release-notes/versioned and https://github.com/apache/pulsar/releases

    cc @SignorMercurio

  16. Anonymitaet commented on Oct 24, 2022

    @Anonymitaet
    Member

    @tisonkun sorry for the misunderstanding.

    Oh, I see, you mean the links in the release notes might be broken.

    For example, now the stable version is 2.10.1.

    If we publish the next version (2.10.2) and add doc links in the 2.10.2 release note, say https://pulsar.apache.org/docs/io-connectors/#kafka, it will be 404 if the next stable version (2.11.x) is published since https://pulsar.apache.org/docs/io-connectors/#kafka is updated to https://pulsar.apache.org/docs/2.10.x/io-connectors/#kafka.

    image

    So does it make sense to add <version-NO.> to the latest stable doc link? @momo-jun @urfreespace @DaveDuggins @D-2-Ed

  17. tisonkun commented on Oct 24, 2022

    @tisonkun
    Member

    @Anonymitaet yes. I think that we should retain the URL /docs/<path> for convenience and current usage, but it helps to serve it as an alias.

    That is, the source of truth is /docs/<latest-version>/<path> and we set up /docs/<content> as an alias to the latest stable versioned one. In this way, users can use /docs/<path> to access the latest stable version (which can be changed), while where there needs an immutable link, it uses /docs/<latest-version>/<path>.

    I think this should be done in the building stage. And let's move the discussion to #17438 instead of polluting this thread :)

  18. github-actions commented on Nov 24, 2022

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

  19. self-assigned this
    on Jan 8, 2023
  20. tisonkun commented on Jan 8, 2023

    @tisonkun
    Member

    I'm adding Docu's builtin support now. Integrate into CI can be a follow-up.

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

Metadata

Metadata

Assignees

Labels

doc-required

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions