Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Path-relative URLs are not working when deployed to GitHub Pages #56

Closed
kean opened this issue Apr 5, 2020 · 3 comments · Fixed by #65
Closed

Path-relative URLs are not working when deployed to GitHub Pages #56

kean opened this issue Apr 5, 2020 · 3 comments · Fixed by #65
Labels
bug Something isn't working

Comments

@kean
Copy link
Contributor

kean commented Apr 5, 2020

Hi, I deployed the documentation generated by swift-doc to GitHub pages. There is an issue with path-relative URLs. For example, if you got to ImageProcessing page and click of any of the URLs there, e.g. ImageProcessors.Resize, it shows 404 page.

I'm using the latest swift-doc from master:

commit 0b2291a52f22a30d5e2528f06be79d40cac570cb (HEAD -> master, origin/master, origin/HEAD)
Merge: e5c4b85 0ac5744
Author: Mattt <mattt@me.com>
Date:   Sun Apr 5 08:15:44 2020 -0700

    Merge pull request #53 from SwiftDocOrg/mattt/operator-fix
    
    Fix logic error when classifying operators in generate subcommand
@mattt mattt added the bug Something isn't working label Apr 5, 2020
@mattt
Copy link
Contributor

mattt commented Apr 5, 2020

Hey @kean. This is a known, albeit undocumented limitation, so thanks for reporting it. Currently, all links are routed using absolute paths, which works for sites hosted at a root domain, but not when they're located in a subdirectory, as in your case.

To solve this correctly, we'll likely need to add a new (optional) parameter to the generate subcommand to specify a base URL. If one is specified, it could either be passed to a <base> tag in the final HTML, or factored into the path helper method.

@kean
Copy link
Contributor Author

kean commented Apr 5, 2020

Have you considered using using relative URLs? Something like this should probably work:

<a href="../ImageProcessors_Resize">ImageProcessors.Resize</a>

@mattt
Copy link
Contributor

mattt commented Apr 6, 2020

As currently implemented, relative links would work on symbol pages, but not for the Home page.
For me, relative paths rank below the two other approaches I described, primarily because it's dependent on a fixed page routing behavior, which we may decide to change in the future.

@kean kean mentioned this issue Apr 9, 2020
@mattt mattt closed this as completed in #65 Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants