The Swift Package Index Blog

Externally hosted package documentation

Posted Monday, October 17, 2022.

We have a little more documentation-related news to announce today!

We love that so many package authors have chosen to host their package’s documentation with the Swift Package Index. There are now more than 180 packages that have opted in for us to host versioned documentation, and we think that’s excellent news for the Swift ecosystem.

Our hosted documentation generation is the easiest way to get DocC documentation hosted on the web, but some projects have more complex requirements or well-established documentation websites. So, we’re pleased to announce that the Swift Package Index now supports external documentation links!

If you’re a package author and would like to configure your package page to link to your external documentation, add or modify the .spi.yml file in your package’s repository root and tell us where to redirect visitors looking for documentation.

Here’s how to do it:

version: 1
  documentation: ""

Here’s an example from GRDB, who already opted into this new feature.

In terms of what visitors to package pages see, it makes no difference where the documentation Lives. Visitors still see a single “Documentation” link in the package page sidebar.

We also created a universal documentation link for any package that has documentation either hosted by us or externally. For any package with documentation, navigate to:{owner}/{repository}/documentation

Replacing {owner} and {repository}, of course, and it will redirect to either our hosted or the external documentation.

The Swift Package Index is a search engine for Swift packages with one goal. To help you make better decisions about dependencies. For more information, the best place to start is with the Frequently Asked Questions.