Replies: 3 comments 1 reply
-
This is a tricky one as we currently don’t persist the rename information anywhere. The nightly script isn’t connected to our database and only operates on the JSON file and the server sees that as a delete and an insert rather than a rename. That doesn’t mean it’s impossible, of course, but the disconnected nature of the package list certainly makes it more challenging. |
Beta Was this translation helpful? Give feedback.
-
As Dave said, doing that automatically would be very difficult. What we could do is manually set up some routes for high profile docs that are moved (i.e. the apple → swiftlang docs). We looked into doing that via Cloudflare and that was prohibitive but there's no reason we couldn't do it inside our DocC proxy in the server. It could just convert a list of known outdated package names prior to doc lookup. |
Beta Was this translation helpful? Give feedback.
-
There is an alternative to a hard coded list, and there are not many downsides to it after a few mins thinking about it. At the point where we are about to 404 for a package that no longer exists, we could make a HEAD request (fairly fast) to GitHub for the repository URL when processing package page requests and documentation requests. If that request returns a 3xx then we can also redirect our request. It wouldn't slow down any page except our 404 page and I don't think there are any other downsides. |
Beta Was this translation helpful? Give feedback.
-
This might be asking for fireworks, but has there been any considerations for redirects for documentation when repositories move? I recall seeing the SPI updates automagically if it spots things moving (for example - apple/swift-docc-plugin to swiftlang/swift-docc-plugin). I wasn't sure how "active" the SPI setup was in providing redirects, and if including them would make?
Whole reason I'm asking is because I went hunting for swift-docc-plugin docs, Google gave me a reference to SPI, but at an older URL: https://swiftpackageindex.com/apple/swift-docc-plugin/1.3.0/documentation/swiftdoccplugin, which resolves to a 404. I knew that the repo had moved, so I could dig it back up at https://swiftpackageindex.com/swiftlang/swift-docc-plugin/1.3.0/documentation/swiftdoccplugin, but I'm not sure that would be all that obvious.
It does get a bit tricky about when and how to expire such redirects, but figured I'd ask...
Beta Was this translation helpful? Give feedback.
All reactions