How to switch template for a document

I know how to switch the template for a component in cms !
But is there also a solution for switching the template for a document in cms.

Assume I have 2 documents matching the same sitemap item (any-matcher), is there a way to change the template inside cms for one of them (like for components).

My use case is, that I render a table of content for longer articles and I do not want to put to much logic into a single template and also avoid to spend an extra sitemap-item (e.g hardcode some pages) .

Thx in advance

Hello Thomas,

if I understand your requirement correctly this page explains how to map different page configuration from a single sitemap item based on document types.

Note that this requires your documents to be of different type.

HTH and kind regards,
Lef

Sounds like a plan - thanks