Thanks
Could you please also give a look at my post just above the one you replied to (the one with six screenshots attached)?
There I describe my exporting procedure in great detail and would like to understand if there is something I can change to make things better or if it is InDesign breaking things.
The things that I'm still trying to understand is why a text anchor in an invisible layer counts as not found ...
This is a known problem: text anchors in hidden layers fail when exported. Or rather, when you hide things, those are not exported in an epub.
In simple words: by hiding those text anchors, obviously during export InDesign throws an error that the TOC entries (which are links) cannot find those destinations. And export fails, of course.
It's not a bug, but I suppose you could call it a glitch? Or "intended behaviour" as a developer would call it.
In any case, three workarounds:
- Hide by layer order. Since you have notation sheets imported as images, simply hide the text frames with chapter styles by arranging the layer with images on top of the text frames, and effectively obscuring those from view
- Hide by changing the text colour to paper. Select the text lines, and set the text colour to "Paper". This will visible hide the text, i.e.: white on white.
- Hide by tiny type size. Change the type size to 0.1pt. It will effectively be invisible, in particular when it is moved to the very right corner of the page.
- Combine methods #1, #2, and #3 😉
(if you do use either method, you will have to define specific paragraph / text styles for the TOC, of course - otherwise your TOC is also affected by the same styling...)
- Hide by assigning a CSS class and hide via a CSS rule. I suppose this would be the 'proper' method.
#5 is arguably the best approach, but the most finnicky to set up in InDesign. Here follows how it works:
To hide the text with css, do the following:
- create a paragraph style called "hide-me". I duplicated the existing chapter heading style.
- In the Export Tagging tab, assign a class called "hidden".

- Confirm the paragraph style changes, and assign this paragraph style to your to-be-hidden chapter headings.
- Open a text editor. And I mean an actual text/code editor like Visual Studio Code, Notepad++ on Windows, or Text Edit on the Mac.
- Create a new file called mystyles.css and save this file in the same folder as your InDesign document project. (This last step is important!!!)
- Add the following lines of code:

- Save the file and close it. Return to InDesign.
- Export your epub. Switch to the CSS tab and point it to that CSS file.

Click the Add Style Sheet button and locate your mystyles.css file.
- Now export your epub. Done. There should no longer be any errors popping up.
- Check your epub file in Thorium and the iBook reader. The headings should be hidden from view. (they are still present in the code, though - but that is good, because searching for these chapter headings is now also possible if need be).
Consider opening and resaving in Sigil to fix the epub code errors that InDesign's shoddy epub export produces and also compress the epub file properly (which, if you use svg files will reduce the file size by a factor of 9).
Or if you don't want to fix those code glitches, run your epub file through eCanCrusher to compress it properly - that way you can use SVG files without worrying about file sizes and Apple complaining about exceeding image pixel dimensions.
PS I would use method #6 myself: open the CSS code in Sigil, add that hidden class to the ebook's existing CSS file, and assign that class to all the headings as a second class (chain it to the existing paragraph heading class) in the xhtml pages.
But then I probably wouldn't be using InDesign in the first place for my epub creation. 😉