Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Links on Commands Reference are broken #35

Closed
Quiark opened this issue Aug 7, 2015 · 5 comments
Closed

Links on Commands Reference are broken #35

Quiark opened this issue Aug 7, 2015 · 5 comments

Comments

@Quiark
Copy link

Quiark commented Aug 7, 2015

At http://ipfs.io/docs/commands/ clicking a command on the top brings me to the main page which is a bit confusing. I don't understand why it doesn't work though. I'm on Windows 7 with Firefox 39

@whyrusleeping
Copy link
Contributor

It looks like the links are to ipfs.io#command instead of ipfs.io/docs/commands#command

@spikebike
Copy link

Hrm, I tracked it down. The website generates that file with:
website/src/ipfs.io/docs/commands/Makefile

Which runs:
ipfs commands | ~/go/src/github.com/ipfs/go-ipfs/bin/gencmdref >$@

Which generates:

- [ipfs](#ipfs)
- [ipfs add](#ipfs-add)
- [ipfs bitswap](#ipfs-bitswap)
- [ipfs bitswap stat](#ipfs-bitswap-stat)
- [ipfs bitswap wantlist](#ipfs-bitswap-wantlist)

Which looks plausible. Then it's rendered into this HTML:

<li><a href="#ipfs">ipfs</a></li>
<li><a href="#ipfs-add">ipfs add</a></li>
<li><a href="#ipfs-block">ipfs block</a></li>
<li><a href="#ipfs-block-get">ipfs block get</a></li>

But in google chrome that weirdly expands to URLs like:
https://ipfs.io/#ipfs-block-get

Instead of the desired:
https://ipfs.io/docs/commands/#ipfs-block-get

I didn't think HREFs needed to set a base URL.

@RichardLitt
Copy link
Contributor

It's because there is a <base /> overriding the URLs. It is set here and is needed for all of the relative links in the <head>, but totally borks the rest of the anchors in the page.

@RichardLitt
Copy link
Contributor

That should fix it. Unhappy though. StackOverflow comment:

The effect of the base tag is global to the document, and the only way to override the effect of is to use absolute URLs.

You can use window.location in JavaScript to get the URL of the page itself, in case the document was retrieved via HTTP. And you could use it to construct absolute URLs.

The base tag is normally not needed these days. It is better to use server-side technologies that let you construct addresses from one or more base addresses. So quite possibly the best approach is to get rid of the tag.

@RichardLitt
Copy link
Contributor

This was fixed! :D

RichardLitt pushed a commit to RichardLitt/website that referenced this issue Mar 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants