-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<div> | ||
<span> | ||
<a href="https://twitter.com/bitcoincoreorg" target="_blank" class=""><i class="fa fa-fw fa-twitter"></i>Twitter</a><br /> | ||
<a href="/en/legal/">Legal</a> | <a href="/en/legal/privacy">Privacy Policy</a> | <a href="/{{ page.lang }}/rss/">RSS <img src="/assets/images/rss-24x24.png" alt="rss feeds" width="14" height="14"></a> | ||
<a href="{{ ROOT_PATH }}/en/legal/">Legal</a> | <a href="{{ ROOT_PATH }}/en/legal/privacy">Privacy Policy</a> | <a href="{{ ROOT_PATH }}/{{ page.lang }}/rss/">RSS <img src="{{ ROOT_PATH }}/assets/images/rss-24x24.png" alt="rss feeds" width="14" height="14"></a> | ||
</span> | ||
</div> | ||
<div> | ||
<img src="/assets/images/bitcoin_core_logo.png" alt="bitcoin core logo" width="160"><br /> | ||
<img src="{{ ROOT_PATH }}/assets/images/bitcoin_core_logo.png" alt="bitcoin core logo" width="160"><br /> | ||
<span class="copyright">© {{ site.time | date: '%Y' }} {{ site.owner.name }}</span> | ||
</div> | ||
|
||
<link rel="stylesheet" href="/assets/css/fonts.css"> | ||
<link rel="stylesheet" href="{{ ROOT_PATH }}/assets/css/fonts.css"> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% assign ROOT_PATH = '' | ||
%}{% assign depth = page.url | split: '/' | size | minus: 1 | ||
%}{% if depth < 1 | ||
%}{% assign ROOT_PATH = '.' | ||
%}{% elsif depth == 1 | ||
%}{% assign ROOT_PATH = '..' | ||
%}{% elsif depth == 2 | ||
%}{% assign ROOT_PATH = '../..' | ||
%}{% elsif depth == 3 | ||
%}{% assign ROOT_PATH = '../../..' | ||
%}{% elsif depth == 4 | ||
%}{% assign ROOT_PATH = '../../../..' | ||
%}{% elsif depth == 5 | ||
%}{% assign ROOT_PATH = '../../../../..' | ||
%}{% elsif depth == 6 | ||
%}{% assign ROOT_PATH = '../../../../../..' | ||
%}{% endif | ||
%} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{% include root_path.html %} | ||
{% capture /dev/null %}<!-- suppress render of this part --> | ||
<!-- Copyright 2013 - 2016 The Bitcoin.org Project. | ||
Copyright 2017 - 2020 The BitcoinCore.org Project | ||
|
@@ -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 commentThe 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 / There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
{% capture FILE_PREFIX %}bitcoin-{{CURRENT_RELEASE}}{% endcapture %} | ||
{% assign SIGNING_KEY_FINGERPRINT = "01EA5486DE18A882D4C2684590C8019E36C2E964" %} | ||
{% capture SIGNING_KEY_FINGERPRINT_EXPLODED %}{% include fingerprint-split.html hex=SIGNING_KEY_FINGERPRINT %}{% endcapture %} | ||
|
@@ -15,54 +16,54 @@ | |
{% assign GPG_WINDOWS_DOWNLOAD_URL = "https://gpg4win.org/download.html" %} | ||
{% assign GITIAN_REPOSITORY_URL = "https://github.com/bitcoin-core/gitian.sigs" %} | ||
{% endcapture %} | ||
<link rel="alternate" type="application/rss+xml" href="/en/releasesrss.xml" title="Bitcoin Core releases"> | ||
<link rel="alternate" type="application/rss+xml" href="{{ ROOT_PATH }}/en/releasesrss.xml" title="Bitcoin Core releases"> | ||
<div class="download"> | ||
<h2>{{ page.latestversion }} {{CURRENT_RELEASE}} <a type="application/rss+xml" href="/en/releasesrss.xml"><img src="/assets/images/icons/icon_rss.svg" alt="rss" class="rssicon"></a></h2> | ||
<div class="mainbutton"><a id="downloadbutton" href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.win64exe }}"><img src="/assets/images/os/but_windows.svg" alt="icon"><span>{{ page.download }}</span></a></div> | ||
<h2>{{ page.latestversion }} {{CURRENT_RELEASE}} <a type="application/rss+xml" href="{{ ROOT_PATH }}/en/releasesrss.xml"><img src="{{ ROOT_PATH }}/assets/images/icons/icon_rss.svg" alt="rss" class="rssicon"></a></h2> | ||
<div class="mainbutton"><a id="downloadbutton" href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.win64exe }}"><img src="{{ ROOT_PATH }}/assets/images/os/but_windows.svg" alt="icon"><span>{{ page.download }}</span></a></div> | ||
<div class="downloadbox"> | ||
<p>{{ page.downloados }}</p> | ||
<div> | ||
<div> | ||
<img src="/assets/images/os/med_win.png" alt="windows"> | ||
<img src="{{ ROOT_PATH }}/assets/images/os/med_win.png" alt="windows"> | ||
<span> | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.win64exe }}" class="dl" id="downloadwinexe">Windows</a> | ||
<span><a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.win64exe }}" class="dl" id="win64exe">exe</a> - | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.win64zip }}" class="dl" id="win64zip">zip</a></span> | ||
</span> | ||
</div> | ||
<div> | ||
<img src="/assets/images/os/med_osx.png" alt="osx"> | ||
<img src="{{ ROOT_PATH }}/assets/images/os/med_osx.png" alt="osx"> | ||
<span> | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}{{ site.data.binaries.macdmg }}">Mac OS X</a> | ||
<span><a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}{{ site.data.binaries.macdmg }}" class="dl" id="macdmg">dmg</a> - | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.mactar }}" class="dl" id="mactar">tar.gz</a></span> | ||
</span> | ||
</div> | ||
<div> | ||
<img src="/assets/images/os/med_linux.png" alt="linux"> | ||
<img src="{{ ROOT_PATH }}/assets/images/os/med_linux.png" alt="linux"> | ||
<span> | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.lin64 }}" class="dl" id="lin64">Linux (tgz)</a> | ||
</span> | ||
</div> | ||
</div> | ||
<div> | ||
<div> | ||
<img src="/assets/images/os/arm.png" alt="ARM Linux"> | ||
<img src="{{ ROOT_PATH }}/assets/images/os/arm.png" alt="ARM Linux"> | ||
<span> | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-arm-linux-gnueabihf.tar.gz" class="dl">ARM Linux</a> | ||
<span><a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-aarch64-linux-gnu.tar.gz" class="dl" id="lin64arm">64 bit</a> - | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-arm-linux-gnueabihf.tar.gz" class="dl" id="lin32arm">32 bit</a></span> | ||
</span> | ||
</div> | ||
<div> | ||
<img src="/assets/images/os/but_riscv.svg" alt="RISC-V Linux"> | ||
<img src="{{ ROOT_PATH }}/assets/images/os/but_riscv.svg" alt="RISC-V Linux"> | ||
<span> | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.riscv64 }}.tar.gz" class="dl">RISC-V Linux</a> | ||
<span><a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}-{{ site.data.binaries.riscv64 }}.tar.gz" class="dl" id="lin64riscv">64 bit</a></span> | ||
</span> | ||
</div> | ||
<div> | ||
<img src="/assets/images/os/med_snap.svg" alt="Snap Store Linux"> | ||
<img src="{{ ROOT_PATH }}/assets/images/os/med_snap.svg" alt="Snap Store Linux"> | ||
<span> | ||
<a href="https://snapcraft.io/bitcoin-core" class="dl">Snap Store Linux</a> | ||
</span> | ||
|
@@ -73,7 +74,7 @@ <h2>{{ page.latestversion }} {{CURRENT_RELEASE}} <a type="application/rss+xml" h | |
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX }}.torrent" class="dl">{{ page.downloadtorrent }}</a> | ||
{% if magnet %} <a href="{{ magnet | replace: '&', '\&'}}" class="magnetlink" data-proofer-ignore></a>{% endif %}<br> | ||
<a href="{{ PATH_PREFIX }}/{{ FILE_PREFIX}}.tar.gz" class="dl">{{ page.source }}</a><br> | ||
<a href="/en/releases">{{ page.versionhistory }}</a> | ||
<a href="{{ ROOT_PATH }}/en/releases">{{ page.versionhistory }}</a> | ||
</p> | ||
<p class="downloadkeys"> | ||
<span>{{ page.releasekeys }}</span> | ||
|
@@ -261,18 +262,18 @@ <h2 style="text-align: center">{{page.build_reproduction}}</h2> | |
var hreflin64 = document.getElementById('lin64').href; | ||
switch (os) { | ||
case 'windows64': | ||
but.getElementsByTagName('IMG')[0].src = '/assets/images/os/but_windows.svg'; | ||
but.getElementsByTagName('IMG')[0].src = '{{ ROOT_PATH }}/assets/images/os/but_windows.svg'; | ||
but.href = hrefwin64exe; | ||
linkwinexe.href = hrefwin64exe; | ||
linkwinzip.href = hrefwin64zip; | ||
break; | ||
case 'linux64': | ||
but.getElementsByTagName('IMG')[0].src = '/assets/images/os/but_linux.png'; | ||
but.getElementsByTagName('IMG')[0].src = '{{ ROOT_PATH }}/assets/images/os/but_linux.png'; | ||
but.href = hreflin64; | ||
linklin.href = hreflin64; | ||
break; | ||
case 'mac': | ||
but.getElementsByTagName('IMG')[0].src = '/assets/images/os/but_mac.svg'; | ||
but.getElementsByTagName('IMG')[0].src = '{{ ROOT_PATH }}/assets/images/os/but_mac.svg'; | ||
but.href = hrefmacdmg; | ||
break; | ||
} | ||
|
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.