-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change all local links to be relative #741
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A clever solution to creating relative links, I like it! Lightly tested and it looks pretty good. Currently our HTMLProofer test reports links on the 404 page and download page are broken. The 404 one does need to be fixed; the download page one either needs the --url-ignore
pattern in Makefile
updated or some additional target/variable we can pass during build that's special for mirrors (including on IPFS). Suggestions included inline. Thanks @raucao !
@@ -6,7 +7,7 @@ | |||
{% assign VERSION_SORTED_RELEASES = site.releases | sort: 'release' | reverse %} | |||
{% capture CURRENT_RELEASE %}{% for subver in VERSION_SORTED_RELEASES[0].release %}{{subver}}{% unless forloop.last %}.{% endunless %}{% endfor %}{% endcapture %} | |||
{% assign magnet = VERSION_SORTED_RELEASES[0].optional_magnetlink %} | |||
{% capture PATH_PREFIX %}/bin/bitcoin-core-{{CURRENT_RELEASE}}{% endcapture %} | |||
{% capture PATH_PREFIX %}{{ ROOT_PATH }}/bin/bitcoin-core-{{CURRENT_RELEASE}}{% endcapture %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the site is going to be a challenge. Although the binaries are served from bitcoincore.org/bin/, they're not a part of this repository and so won't be included in a site build unless the builder goes through the extra effort of wget'ing them from the main site.
Edit: thinking about this some more, I think maybe the right solution is to have a special build target / JEKYLL_ENV
variable that causes mirror copies of the download page to only link to the torrent magnet link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as additional input, it appears feasible to host larger files on IPFS, too: https://blog.ipfs.io/2020-02-14-improved-bitswap-for-container-distribution/
The question would be how to link them exactly. Going up one node relative to the root path should do the trick I guess. Also, we would need an IPFS-specific build of at least the download page in this case.
@@ -0,0 +1,18 @@ | |||
{% assign ROOT_PATH = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently produces bad links when assets/elements/404.md
is rendered as the content of that page is served at the URL of a non-existent page (e.g. https://bitcoincore.org/foo/bar ), and that URL may be more or less deep than the static 404 page. I think maybe you could throw a {% if page.permalink == "/404.html" %}{% assign ROOT_PATH="" %}{% endif %}
in there to fix, since I suspect IFPS doesn't have an automatic 404 redirect feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have just added the switch.
Since go-ipfs 0.7.0 (latest stable version), the built-in HTTP gateway supports custom 404 pages. So we could add a special one for this site, but would have to think about how that would work with relative links.
Not sure if this means the 404 links on bitcoincore.org would now be broken when looking at a nested path.
Needs rebase? |
@MarcoFalke rebased in #881, HTH |
Thanks! |
In order for the static website to work when hosted under nested paths/directories, e.g.
https://some-ipfs-gateway.com/ipfs/some-content-hash/
, all links and source file paths need to be relative to the respective documents, instead of absolute from the root.(This branch may need some more adjustments before it can be merged, as I have not familiarized myself with the site release process yet.)
refs #739