05-17-2012, 03:56 PM | #1 |
Member
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
|
Internal links, and Contents as illustration directory
Hi all –
I’d like to mention an illustration located in another chapter, and allow the reader to click on its name to go to it. I’d hoped the code used by the Contents would allow this. Surely, if at some point in the code you have: <p class="contents"><a href="#Preface">Preface</a></p> ...it would produce a clickable example of ‘Preface’, which should take the reader to: <a name="Preface"> This works in the Contents, but why won’t it work when I use the same structures elsewhere? It looks like it’s going to work but transfers to the next new chapter after where it should have gone. :-( Also, once I’ve solved that, how would it be to convert the Contents into a list of illustrations? Could it be called something other than Contents? I’m using Calibre to construct e.g. mobi files from html and it’s going ok. Cheers... |
05-17-2012, 06:58 PM | #2 | |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
This has the advantage that you can use Sigil's integrated FlightCrew validator to check for structural errors and other issues before the .mobi conversion. I'm assuming that you want to use images as chapter headers. If that's the case and all chapters are in the same .html file, you could try the following: Code:
<h3>TOC</h3> <p><a href="#ch1">Chapter 1</a></p> <!-- more TOC entries --> <h3 id="ch1" title="Chapter 1"><img alt="" src="ch1.JPG" /></h3> BTW, using header tags with title attributes will allow you to automatically generate an .ncx TOC once you're done with the book. |
|
Advert | |
|
05-17-2012, 09:04 PM | #3 |
Member
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
|
Thanks, Doitsu
My choice is either simply to implement a direct 'click to illustration' facility and then publish, or just publish as is. The Calibre route produces mobi output which seems to work fine on the Kindle Previewer, and the KP will also translate epub Calibre output back to mobi and show that pretty ok too. I'm not using images as chapter headers, I just want to say "...as shown in fig. 5.1..." for example, and allow them to click on 'fig. 5.1' to get to it. A regards the code you show, I have tried to get to the bottom of TOC but no explanation I've seen ever seems to make full sense. Calibre seems to produce what's required automatically, and as I say, trying to use the grammar in what seems to be the TOC section in my code doesn't do what it should do. Do you know why? I do have everything (except images) all in the one html file, but my TOC section starts: <a name="TOC"/> and not... <h3>TOC</h3> as you show. Cheers, ... |
05-18-2012, 01:26 AM | #4 | |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
For example: Code:
<p>Once the data point is selected, a window as shown in <a href="#F5.1">Fig. 5.1</a> will be displayed.</p> <p>More text...</p> <p>More text...</p> <p>More text...</p> <p><img id="F5.1" src="5.1.JPG" /></p> I enclosed my sample TOC header in h3 tags, because all book headings should be enclosed in header tags; I didn't add a name attribute, because I don't backlink to the TOC from my chapter headings. |
|
05-18-2012, 06:27 AM | #5 |
Member
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
|
Thanks again, Doitsu!
What's going wrong it that I can't find a way to click on something and be transported elsewhere within the book, except in the Contents... and I can't see why the mechanism I try to copy from that, doesn't work. Thanks for the advice on not starting link ids with a number. Mine do though start with letters. I do try to put images nearest where they will be most discussed, but an image of a skeleton will contain useful points that multiple chapters will want to refer to. Thanks, Streadmob. |
Advert | |
|
05-18-2012, 07:46 AM | #6 |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
Most likely you made a subtle mistake somewhere in the book. Try converting it to ePub and then check it here.
Also, if possible, post a small excerpt of your book with link problems as an ePub file. |
05-18-2012, 08:13 AM | #7 |
Member
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
|
Thanks again. I optioned my Calibre output to epub and sent that file to the epub validator, and got back a massive list of errors about a thousand lines long. (When in the past I've output to epub then converted back to mobi using the Kindle Previewer, it worked ok.)
I downloaded Sigil but it always crashed as I opened it. And I've got someone else's cat hiding in my attic! Thanks for all your efforts anyway, Streadmob. |
05-18-2012, 08:50 AM | #8 |
A Thirsty Mind
Posts: 92
Karma: 2546
Join Date: May 2011
Location: Lubec, Maine
Device: Kindle Fire, iPad, iPhone
|
Why are you not bookmarking your image in HTML, then at the text that you want to use to 'go to' that bookmark (see Figure 5-1), just link it back to the bookmark? I do this all the time and it always works.
|
05-18-2012, 01:05 PM | #9 |
Member
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
|
Hi AThirstyMind –
Well, I think that's what I was trying to do! But I just Googled: bookmarking HTML, and found what I may have been doing wrong. When I should have coded: <a name="figure517"> </a> ...I actually coded: <a name="figure517"> I've now added the </a> and it works. But I still haven't been able to get it to go straight to an image; I need that extra label line I've shown above, just before the image, which I jump to using: <p><a href="#figure517"> click here for fig5.17 </a></p> . If instead I was wanting to jump to: <p class="center"><img src="fig517.gif" alt="fig517"></p> , then the following actually jumps a long way earlier than that, to near or at the start of the file: <p><a href="#fig517"> click here for fig5.17 </a></p> . Aha! It works if I add the name parameter in with the other two image parameters separately: <p class="center"><img src="fig518.gif" alt="fig518" name="figure518"></p> ...if successfully found by: <p><a href="#figure518"> click here for fig5.18 </a></p> . Anyway, thanks for encouraging me to have another go! Cheers, Streadmob Going back to the possibility of converting the Contents list to a list of illustrations, my Contents starts: <h1>Contents</h1> <p class="contents"><a href="#Flyleaf/Back cover">Flyleaf/Back cover</a></p> <p class="contents"><a href="#Preface">Preface</a></p> <p class="contents"><a href="#Introduction">1 Introduction </a></p> etc. It looks like I'm allowed to change the 'Contents' to 'List of Images' , and then just put the image names and labels in. I just hope that won't mess things up if and when I produce an epub file instead of a mobi. ?? |
05-21-2012, 01:30 PM | #10 |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
By the way name= is now destandardized. It should be id=
If Flyleaf is a folder then the # should be removed in your example. # is only a link within a file at the source level. Dale |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Internal Links best Practices | Jamestoo | ePub | 2 | 02-26-2012 11:26 AM |
Directory contents & opening books through kindlets | firefoxpdm | Kindle Developer's Corner | 5 | 08-10-2011 10:28 AM |
Links to URLs work, internal links don't? | NewDay | ePub | 36 | 10-27-2010 04:09 AM |
Is there a way to browse the Kindle contents by directory? | sweevo | Amazon Kindle | 1 | 09-15-2010 04:07 PM |
Internal Links??? | Guns4Hire | PocketBook | 11 | 04-18-2010 02:25 AM |