Excluding Table of Contents from generated RSS feed with .Summary

Hello.

Some of my pages contain a .Page.TableOfContents. This gets included in the generated RSS, which is not desirable.

The relevant part of the RSS feed logic looks like this

<description>{{ .Summary | html }}</description>

I’ve read the docs. I know I can use or frontmatter to set the summary ,but that would mean I need to write it myself even though the text after the table of contents would work fine.

To prevent having to set a summary myself, I would like to know if I can exclude the page of ocntents from the automated summary somehow.

Thanks!

You cannot exclude the TOC from the automatic summary.

Look into manual and front matter summaries:
https://gohugo.io/content-management/summaries/

Just an idea

If it fits your design and use case - the summary is not just the first part of the page content, but an elaborated short page summary - you could go with manual Summary above the toc.

Summary Text
<!--more-->
{{ .TableOfContent }}
Page content