# Two .Content sections in one markdown file?

**URL:** <https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026>\
**Category:** Uncategorized\
**Created:** [December 27, 2018, 10:39pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026 "2018-12-27T22:39:34Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![pisuke](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@pisuke](https://discourse.gohugo.io/u/pisuke)\
**Post date:** [December 27, 2018, 10:39pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/1 "2018-12-27T22:39:34Z")

</div>

Is there a way to have two or more “Content” sections in the same markdown file?  
.  
Let’s say that for an ecommerce site each single page (template single.html) has two free text sections: one for the overall product description and one for the specifications.

Ideally, these two sections would be written in markdown language below the front matter of the .md file for that given page, and then called from single.html with something similar to {{ .Content }}. The issue is that {{.Content}} fetches everything below the front matter… Is it possible to separate that content of the .md file in two or more subsections of {{.Content}}?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [December 27, 2018, 11:04pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/2 "2018-12-27T23:04:57Z")

</div>

Currently no – but your use case may be solved in a nice way using a page bunde (seach the docs). Have a look at the showcase section in Hugo docs site for inspiration.

---

<div class="post-metadata">

**Author:** ![pisuke](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@pisuke](https://discourse.gohugo.io/u/pisuke)\
**Post date:** [December 28, 2018, 2:22pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/3 "2018-12-28T14:22:43Z")

</div>

Thanks for the reply bep.

Yes… I’ve noted the possibility of bundle several .md files together (using this feature for the images already), but it’d be probably leaner to have everything in the same .md file, and access it in a similar way as we can access the shortcodes with .Inner.

Do you know, if there’s a plan to implement such feature in future versions?

Cheers

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [December 28, 2018, 5:27pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/4 "2018-12-28T17:27:25Z")

</div>

> [@pisuke](#):
>
> Do you know, if there’s a plan to implement such feature in future versions?

That feature is not planned, as page bundles gets the job done. 🙂

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [December 28, 2018, 9:16pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/5 "2018-12-28T21:16:12Z")

</div>

> [@maiki](#):
>
> That feature is not planned, as page bundles gets the job done. 🙂

Not entirely correct. I have some plans in this department; I have talked about it elsewhere – on my TODO list is to update to Blackfriday 2, which should allow us to create a “content map” of sorts, which would be a tree of your content. The plans are a little bit vague, but the main point is to get a data structure with ToC and footnotes etc, but I assume this could be extended to “content sections”.

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [December 28, 2018, 10:02pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/6 "2018-12-28T22:02:10Z")

</div>

What does that look like for a markdown file? Like, multiple `---` sections, or a different way to markup “content” section in front matter?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [December 28, 2018, 11:01pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/7 "2018-12-28T23:01:54Z")

</div>

> [@maiki](#):
>
> What does that look like for a markdown file?

It currently does not look like anything. But the obvious first iteration would be to provide the headers as the sections, e.g.

```auto
{{ range .Content.Toc }}
{{ range .Content.Headers.H2 }}
{{ range .Content.Footnotes }}

```

But we could also imagine “custom annotations” to create sections, e.g.

```auto
{{range .Content.MySections }}

```

The above is very quickly made up for this post. But my ultimate goal is that you in a very speedy way should be able to traverse the content tree from file/directories and down to paragraph level in a speedy way.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [December 31, 2018, 11:06am UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/8 "2018-12-31T11:06:34Z")

</div>

> [@bep](#):
>
> But my ultimate goal is that you in a very speedy way should be able to traverse the content tree from file/directories and down to paragraph level in a speedy way.

Just want to add there are many cool things that this would enable:

- Insert an ad after every 5th (or something) paragraph
- Insert author byline etc. after the summary
- Present the ToC with any markup you want
- Put the footnotes wherever you want
- … insert your imaginary use cse here

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 31, 2018, 3:33pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/9 "2018-12-31T15:33:03Z")

</div>

> [@bep](#):
>
> … insert your imaginary use cse here

Content paragraph control in my use case would speed up image intensive projects that currently rely on shortcodes.

I have found out that too many shortcodes come with a price. Inserting images at the template level through a good old parameter or resources is always faster.

However the situation upstream with Blackfriday 2 and that other slow fork (that mmark now uses) is a bit like catch 22 and it doesn’t seem like the situation will change anytime soon.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [December 31, 2018, 5:15pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/10 "2018-12-31T17:15:55Z")

</div>

> [@alexandros](#):
>
> is a bit like catch 22 and

There is no catch 22. This is all about time and priority.

---

<div class="post-metadata">

**Author:** ![maikewng](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@maikewng](https://discourse.gohugo.io/u/maikewng)\
**Post date:** [November 5, 2019, 12:29pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/11 "2019-11-05T12:29:43Z")

</div>

+1 for this. I am creating a homepage which needs to show different parts of the content in separate sections, and the approach that you outlined seems to me a very clean and flexible solution. Your post has been written about one year ago, has there been any progress on this or a comparable feature?

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [November 5, 2019, 4:56pm UTC](https://discourse.gohugo.io/t/two-content-sections-in-one-markdown-file/16026/12 "2019-11-05T16:56:50Z")

</div>


