While upgrading the blog software used for this blog I wanted to fix a problem with table of contents (TOC) within blog posts. Activating a TOC with just this reStructuredText directive:

.. contents::


leads to a problem with the headline of the post on the home page. Because it will already become a local link to the entry in the TOC it won’t work as a link to the posts page anymore. Not even the link to the TOC does work if it is not on the home page because only the introduction part or teaser is displayed there because blog posts with TOC usually tend to be looong posts.

So I opened Issue #23 at the Github project and got the following snipped as workaround:

.. contents::
:depth: 2
:local:


This excludes the title from the TOC leaving it ”free” to use as link to the blog post itself. Thanks to Christian Jann for this solution.

So can you expect more long posts from me in the future? Well there is at least one in the drafts folder, but it still needs some polishing. So don’t hold your breath…