bird-team / brisbane-bird-atlas

Atlas of the Birds of Brisbane: Community bird atlas for Brisbane, Australia
https://brisbanebirds.com
GNU General Public License v3.0
3 stars 0 forks source link

How to create an inter-species link that works for both website and book? #133

Closed Louis-Backstrom closed 5 years ago

Louis-Backstrom commented 5 years ago

Not entire sure this is possible but figured I'd check because if it is that would be fantastic.

If I want to put in a link to another species account (or even any other page within the Atlas) within a page, is it possible to do that such that it can be functional in both versions of the Atlas?

i.e. when using the website, I want this link image to take me to https://brisbanebirds.com/contributing.html, as it currently does, but when using the book I want it to take me to the contributing page within the book, rather than prompting me to open the link in the website.

Is it possible to have both at the same time? Hope I've made it clear enough. Currently I'm just linking everything as if it's a hyperlink:

image

jeffreyhanson commented 5 years ago

It looks like this should be possible (outside of captions), see https://bookdown.org/yihui/bookdown/cross-references.html. Hopefully, something like [Contributing] should work.

Louis-Backstrom commented 5 years ago

Hmm okay, thanks for this @jeffreyhanson - I'll see if it works when I get round to a bit more editing. Might be hard to really test with the website broken though.

jeffreyhanson commented 5 years ago

Ok thanks. Yeah, true. You could use the command make book_website to create a local copy on your computer for debuggig/previewing, it should appear in the _book folder, and you can open it with the index.html file.

Louis-Backstrom commented 5 years ago

Ah okay great, I didn't realise that was a thing we could do - could that be done on a remote server hypothetically to help us fix #129?

jeffreyhanson commented 5 years ago

Yeah - this is pretty much exactly what CircleCI and TravisCI do to generate the pdf and websites. The only advantage with using these services is that they are (1) free and (2) are relatively easy to setup such that they will automatically rebuild the pdf/website when commits are made.

Louis-Backstrom commented 5 years ago

Hmm okay, this seems to have half worked - the links to the contributing page work (where added) but the links to species pages don't? I'm guessing it's because they aren't treated as headings, but rather sub-pages or similar. I'm sure there's a fix but don't know what it is at the moment - the bookdown wiki hasn't given me an answer yet.

E: I think it might be because they don't have standard headers (as we autopopulate it using fancy code etc) - is there a way around this?

Louis-Backstrom commented 5 years ago

Also, I now have a working copy of the website on my computer - is there a way I can push that to be live, or does it have to go through CircleCI?

jeffreyhanson commented 5 years ago

Well, technically yes - but this isn't a sustainable solution.

Louis-Backstrom commented 5 years ago

I thought as much - I'll leave it as is for the moment - the website still is functional at least.

Louis-Backstrom commented 5 years ago

Any ideas for how to fix this issue with the species pages? I haven't been able to work a fix out yet.

Louis-Backstrom commented 5 years ago

This is fixed - huzzah!

The trick is to put species links in as follows: [Link Text](#species-name-binomial-name) - not sure why the hash needs to be there but apparently it does (otherwise the link in the book will just revert to the title page?). Hopefully everything works nicely from now.