mirror of https://github.com/docker/docs.git
Fix for hash links issue #413
This commit is contained in:
parent
27d00ce54a
commit
47de0e2073
|
@ -3,7 +3,6 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign crumbs = page.url | split: '/' %}
|
{% assign crumbs = page.url | split: '/' %}
|
||||||
{% assign stoppingpoint = crumbs | size | minus: 1 %}
|
{% assign stoppingpoint = crumbs | size | minus: 1 %}
|
||||||
{% assign output = "" %}
|
|
||||||
{% for crumb in crumbs %}
|
{% for crumb in crumbs %}
|
||||||
{% if forloop.index == stoppingpoint %}
|
{% if forloop.index == stoppingpoint %}
|
||||||
{% capture basehref %}{{basehref}}{{ crumb }}/{% endcapture %}
|
{% capture basehref %}{{basehref}}{{ crumb }}/{% endcapture %}
|
||||||
|
@ -209,10 +208,19 @@ ng\:form {
|
||||||
|
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
var x = document.links.length;
|
var x = document.links.length;
|
||||||
|
var baseHref = document.getElementsByTagName('base')[0].href
|
||||||
for (i = 0; i < x; i++) {
|
for (i = 0; i < x; i++) {
|
||||||
var munged = false;
|
var munged = false;
|
||||||
var thisHREF = document.links[i].href;
|
var thisHREF = document.links[i].href;
|
||||||
if (thisHREF.indexOf(window.location.hostname) > -1 && document.links[i].className.indexOf("nomunge")<0)
|
var originalURL = "{{ page.url }}";
|
||||||
|
if (thisHREF.indexOf(baseHref + "#") > -1)
|
||||||
|
{
|
||||||
|
// hash fix
|
||||||
|
//console.log('BEFORE: base:',baseHref,'thisHREF:',thisHREF,'originalURL:',originalURL);
|
||||||
|
thisHREF = originalURL + thisHREF.replace(baseHref,"");
|
||||||
|
//console.log('AFTER: base:',baseHref,'thisHREF:',thisHREF,'originalURL:',originalURL);
|
||||||
|
}
|
||||||
|
if ((thisHREF.indexOf(window.location.hostname) > -1 || thisHREF.indexOf('http') == -1) && document.links[i].className.indexOf("nomunge")<0)
|
||||||
{
|
{
|
||||||
munged = true;
|
munged = true;
|
||||||
thisHREF = thisHREF.replace(".md","/").replace("/index/","/");
|
thisHREF = thisHREF.replace(".md","/").replace("/index/","/");
|
||||||
|
|
Loading…
Reference in New Issue