Avoiding orphan chapter entries in TOC

I have a TOC with 2 levels of headings. I would like to keep the Heading 1 in a text block with any or all Heading 2 entries that follow. This ought to be possible (I haven’t a silly amount of sub-headings) but I always seem to get one chapter heading orphaned at the bottom of the page.

I could force a page entry before each Heading 1, but then I get a page break just after the Table of Contents header. Plus, I can probably fit three or four chapters per page. I have played about with the Contents 1 and 2 styles, but I can’t get this to work. Am I missing something? Thanks.

If I understand correctly the question, your concern is the TOC only, not the chapter headings.

As you noticed, the TOC is formatted with Contents n paragraph styles.

To avoid orphaned “chapter headings”, i.e. Contents 1 paragraphs, modify said Contents 1 Text Flow tab to check the box Keep with next paragraph. This will ensure there are one Contents 1 and at least one Contents 2 at the bottom of the page.

Don’t do the same on Contents 2 otherwise you require the whole TOC to be a single block which can’t be achieved for multipage TOCs and results in the “keep” constraint to be ignored.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

Thanks. I could have sworn that was one of the things I tried, but it seems to be working.