/DetectBrokenUrlsPublishPlugin

A Publish plugin to detect broken urls in html files in the output folder.

Primary LanguageHTMLMIT LicenseMIT

Detect Broken URLs plugin for Publish

A Publish plugin to detect broken urls in html files in the output folder.

Installation

To install it into your Publish package, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        ...
        .package(name: "DetectBrokenUrlsPublishPlugin", url: "https://github.com/[user_name]/detectbrokenurlspublishplugin", from: "0.1.0")
    ],
    targets: [
        .target(
            ...
            dependencies: [
                ...
                "DetectBrokenUrlsPublishPlugin"
            ]
        )
    ]
    ...
)

Then import DetectBrokenUrlsPublishPlugin wherever you’d like to use it:

import DetectBrokenUrlsPublishPlugin

For more information on how to use the Swift Package Manager, check out this article, or its official documentation.

Usage

The plugin can then be used within any publishing pipeline like this:

import DetectBrokenUrlsPublishPlugin
...
try Website().publish(using: [
    ...
    .installPlugin(.detectBrokenUrls),
    ...
])

Note, that the html files must already be present in the output folder at the corresponding step in the publishing pipeline. It is therefore best to add this step after .generateHTML(...).

License

Lincensed under the MIT license.