I wanted to try out the mix of Data (including shortcodes) with .Content in a blog post.
I created the following files/content:
# data/podcasts.yml
- title: "podcast 1"
rating: 3
www: https://example.org
txt: |
This is a long text
with more lines
and more
{{< blockquote >}}
and a shortcode [with a link](https://example.org).
{{< /blockquote >}}
- title: "podcast 2"
- title: "podcast 3"
# layouts/blog/single.html
{{ define "main" }}
{{ .Page.ReadingTime }}
{{ .TableOfContents }}
{{ .Content }}
{{ if .Site.Data.podcasts }}
{{ range sort .Site.Data.podcasts }}
<h3>{{ .title }}</h3>
{{ $opts := dict "display" "block" }}
{{ .txt | $.Page.RenderString $opts }}
{{ end }}
{{ end }}
{{ end }}
This looks good so far. But the .Page.ReadingTime and .TableOfContents don’t contain the content of the yml file.
Is this even possible to mix/add? Can I overwrite .Content or add to it? Should I use a ScratchPad? Would a Content Adapter be a solution (although I don’t want to create “subpages”)?
Thanks a lot for any help, even if it’s just “no, this is not possible” so I can do it the “normal” way and not use Data
Hm, I see what you mean but then I have the problem that the shortcodes in my yml will not be properly rendered. Thanks, I think I have to live with these headers not included in the TOC.