Hi Matthew,
In a post a year ago, Lisa May identified identified the problem perfectly. And I have the simple solution for you and others who have fixed the missing anchors one at a time.
First, this is a only a problem when exporting a Reflowable EPUB. Indexes for Fixed Layout EPUBS have both ends of the page range as active links!
The solution is to use BBEdit or Text Wrangler to do a search and replace in the index.xhtml file using a GREP expression.
Here is the problem line in my book index.
<p class=”Index-Body”>abduction 132–137
Page 137 has an empty href=””.
Here is the GREP expression
Find: ([0-9]*)
Replace: \1
And here is the new line
<p class=”Index-Body”>abduction 132–137
The page range still has the 137, it still won’t be an active link, but it won’t throw an error in epub validation.
To show you how the Fixed Layout does not have this problem, here is the code generated by InDesign.
<p class=”Index-Body ParaOverride-1″><span id=”_idTextSpan130758″ class=”CharOverride-7″ style=”position:absolute;top:1146.24px;left:0px;letter-spacing:-0.23px;”>abduction </span>
<span id=”_idTextSpan130759″ class=”CharOverride-7″ style=“position:absolute;top:1146.24px;left:927.39px;”>132</span>
<span id=”_idTextSpan130760″ class=”CharOverride-7″ style=“position:absolute;top:1146.24px;left:1224.03px;”>–</span>
<span id=”_idTextSpan130761″ class=”CharOverride-7″ style=”position:absolute;top:1146.24px;left:1331.15px;”>137</span>
Both ends of the page range are active links in FXL EPUBS.
My index had 598 missing page anchors, all repaired in a few seconds.
Anne-Marie,
I have run Laura Brady’s two scripts and sadly they do not generate “real page numbers.”
I will therefore use the method I invented for my 2011 book.
But I am now working on a more general solution and will report this on your public pages.
I just tried to respond to a post on your “Page Anchor not found” page.
Page anchor not found
But it did not appear to change the page.
I have a general solution to the “Page Anchor not found” problem that does not require making hundreds of changes, as Lisa May and other in this thread did.
Here is what I tried unsuccessfully to post. Maybe you could post it, or help get my posting working on public pages? Thanks.
Lisa May,
You have identified the problem perfectly. And I have the simple solution for you and others who have fixed the missing anchors one at a time.
First, this is a only a problem when exporting a Reflowable EPUB. Indexes for Fixed Layout EPUBS have both ends of the page range as active links!
The solution is to use BBEdit or Text Wrangler to do a search and replace in the index.xhtml file using a GREP expression.
Here is the problem line in my book index (the link is to “abduction” in the chapter “induction”).
<p class=”Index-Body”>abduction 132–137
Page 137 has an empty href=”” which throws a validation error.
Here is the GREP expression
Find: ([0-9]*)
Replace: \1
And here is the new line
<p class=”Index-Body”>abduction 132–137
The page range still has the 137, it still won’t be an active link, but it won’t throw an error in epub validation.
To show you how the Fixed Layout does not have this problem, here is the code generated by InDesign.
<p class=”Index-Body ParaOverride-1″><span id=”_idTextSpan130758″ class=”CharOverride-7″ style=”position:absolute;top:1146.24px;left:0px;letter-spacing:-0.23px;”>abduction </span>
<span id=”_idTextSpan130759″ class=”CharOverride-7″ style=“position:absolute;top:1146.24px;left:927.39px;”>132</span>
<span id=”_idTextSpan130760″ class=”CharOverride-7″ style=“position:absolute;top:1146.24px;left:1224.03px;”>–</span>
<span id=”_idTextSpan130761″ class=”CharOverride-7″ style=”position:absolute;top:1146.24px;left:1331.15px;”>137</span>
Both ends of the page range are active links in FXL EPUBS.
Index links in FXL are not to specific tagged words, but to pages. So they just add the difference in the range (in this case 5 more pages).
My Flow index had 598 missing page anchors, all repaired in a few seconds.