# Markdown content renders as regular text in summary

**URL:** <https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396>\
**Category:** support\
**Created:** [July 3, 2015, 6:11am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396 "2015-07-03T06:11:03Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dieterbe](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dieterbe/32/428_2.png) [@Dieterbe](https://discourse.gohugo.io/u/Dieterbe)\
**Post date:** [July 3, 2015, 6:11am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/1 "2015-07-03T06:11:03Z")

</div>

hi all,  
i’m probably doing something stupid but i’m just not seeing it…

my index.html includes a partial template summary.html and said summary template uses {{ .Summary }} to show a preview of the post.

this has always worked fine with my html content.  
However now I made a post in markdown format, which successfully renders as html when viewed in full, but doesn’t show properly in the summary in index.html, the markdown list syntax is ignored, it’s basically just “straight” plaintext.

see it in action on [http://dieter.plaetinck.be/](http://dieter.plaetinck.be/), the post with title "Moved blog to hugo, fastly and comma"  
note when you click on the title and go to [http://dieter.plaetinck.be/post/moved-blog-to-hugo-fastly-comma/](http://dieter.plaetinck.be/post/moved-blog-to-hugo-fastly-comma/) it renders fine.

the source of that post is here [https://github.com/Dieterbe/dieterblog/blob/master/content/post/moved-blog-to-hugo-fastly-comma.md](https://github.com/Dieterbe/dieterblog/blob/master/content/post/moved-blog-to-hugo-fastly-comma.md)  
the theme is at [https://github.com/Dieterbe/hugo-theme-blog](https://github.com/Dieterbe/hugo-theme-blog)

thanks!

---

<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:** [July 3, 2015, 8:17am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/2 "2015-07-03T08:17:36Z")

</div>

This is as designed.

If you want to keep the formatting you have to manually insert the split after the summary (i have this in all my archetypes so I do not have to remember the syntax):

```auto
<!--more-->

```

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [July 3, 2015, 9:55am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/3 "2015-07-03T09:55:44Z")

</div>

On a blog I’m working on now, I did not like either the auto-rendered summary or the result of putting `<!--more-->` after what I want for the summary, so I specify the summary in a frontmatter tag and display that instead.

FWIW.

---

<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:** [July 3, 2015, 10:26am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/4 "2015-07-03T10:26:18Z")

</div>

> [@RickCogley](#):
>
> FWIW.

Yea, and then you can use the `markdownify` template func.

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [July 3, 2015, 10:52pm UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/5 "2015-07-03T22:52:08Z")

</div>

Good point @bep

---

<div class="post-metadata">

**Author:** ![Dieterbe](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dieterbe/32/428_2.png) [@Dieterbe](https://discourse.gohugo.io/u/Dieterbe)\
**Post date:** [July 5, 2015, 12:49am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/6 "2015-07-05T00:49:24Z")

</div>

you’re right. the `<!--more-->` works fine. i can insert it at arbitrary points within the list and the markdown will render properly in the summary as a valid list (i thought perhaps the `</ul>` would be missing, breaking the layout of the content below but that’s not the case.).

Reading the summaries docs again it makes a lot more sense now. thanks

---

<div class="post-metadata">

**Author:** ![Dieterbe](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dieterbe/32/428_2.png) [@Dieterbe](https://discourse.gohugo.io/u/Dieterbe)\
**Post date:** [July 5, 2015, 12:59am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/7 "2015-07-05T00:59:46Z")

</div>

beautiful. I like how toml seamlessly supports newlines, so the summary specified in the front matter can be multiple lines.

for completeness, this is the approach you and @bep meant right?

```auto
+ {{ if .Params.summary }}
+ {{ .Params.summary | markdownify }}
+ {{ else }}
                {{ .Summary }}
+ {{ end}}

```

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [July 5, 2015, 1:48am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/8 "2015-07-05T01:48:06Z")

</div>

Yeah, that should work basically, but summary is probably a special or blessed word within Hugo, so you might use another string for the arbitrary one, like postsummary or whatever.

```
{{ if .Params.postsummary }}
  {{ .Params.postsummary | markdownify }}
{{ else }}
  {{ .Summary }}
{{ end}}
```

---

<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:** [July 5, 2015, 7:50am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/9 "2015-07-05T07:50:42Z")

</div>

Looks good. Here is a related little trick I use:

```auto
 {{ with .Params.title_lead }}<h3 class="post-title-lead">{{ . | markdownify }}</h3>{{ end }}        
<h1 class="post-title">{{ with .Params.title_main}}{{ . | markdownify }}{{ else }}{{ title .Title }}{{end}}</h1>      

```

This is the title section of my `_default/single.html` on one of my sites.

Here I fall back to the builtin `.Title`, but sometimes I want a title that spans multiple lines or with special formatting (make one word italic …) etc. And in some articles I add what I call a title\_lead to prefix the title.

---

<div class="post-metadata">

**Author:** ![variable](https://avatars.discourse-cdn.com/v4/letter/v/cab0a1/32.png) [@variable](https://discourse.gohugo.io/u/variable)\
**Post date:** [November 9, 2015, 4:56am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/10 "2015-11-09T04:56:34Z")

</div>

Is there a way to still use markdownify, but filter out a specific tag, for example “a” tags as they break things!

---

<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:** [November 9, 2015, 12:46pm UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/11 "2015-11-09T12:46:24Z")

</div>

> [@variable](#):
>
> Is there a way to still use markdownify, but filter out a specific tag, for example “a” tags as they break things!

Sure, it’s called editing. If you do not want “a” tags in your custom summary, don’t put it there.

---

<div class="post-metadata">

**Author:** ![TheColonial](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/thecolonial/32/922_2.png) [@TheColonial](https://discourse.gohugo.io/u/TheColonial)\
**Post date:** [November 26, 2015, 3:51am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/12 "2015-11-26T03:51:39Z")

</div>

Markdown support looks to be slightly broken in the context of summaries. It appears that if you have any links in your summary that make use of a reference section at the bottom of the post, then those links aren’t populated.

---

<div class="post-metadata">

**Author:** ![parsiya](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/parsiya/32/1218_2.png) [@parsiya](https://discourse.gohugo.io/u/parsiya)\
**Post date:** [January 26, 2016, 1:59am UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/13 "2016-01-26T01:59:57Z")

</div>

I had the same problem, it seems that Hugo first splits the markdown content by `helpers.SummaryDivider` or `<!--more-->`, applies shortcodes and then finally renders it with `helpers.BytesToHTML`. So the reference links at the bottom of the page are not part of the summary when it is converted.

Function `setSummary`: [https://github.com/spf13/hugo/blob/master/hugolib/page.go#L194-L234](https://github.com/spf13/hugo/blob/master/hugolib/page.go#L194-L234)

I don’t know if this is by design but for now I just a copy of the link references before the SummaryDivider.

---

<div class="post-metadata">

**Author:** ![linuxmail](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/linuxmail/32/12006_2.png) [@linuxmail](https://discourse.gohugo.io/u/linuxmail)\
**Post date:** [May 19, 2018, 1:35pm UTC](https://discourse.gohugo.io/t/markdown-content-renders-as-regular-text-in-summary/1396/14 "2018-05-19T13:35:29Z")

</div>

Hello,

just wanted to say, that I have also the “problem”. The author from my favorite theme (mainroad), told me the same, that it is for now not possible to have a summary with styles. I have often only two or three sentences with a link or a short command.  
It did not find it usefull, to put every the`<!--more-->`, also to add it to my imported Wordpress posts. So it would be great to have summary but with CSS/Mardown enabled 🙂
