Adding 'description' YAML tag to BeautifulHugo

I’m trying to add a description tag to my posts (hosted on Github at ). I’m following the instructions from , but the solutions provided there aren’t working. Despite making the changes suggested, my website displays the automatic 70 word summary for each post and does not use the text in my ‘description’ tag.

What am I doing wrong? Is there an obvious workaround I am not aware of here?


Are you wanting your site to use description on the main page which lists blog posts?

What you’ll need to do is override the layout of index.html.

It’s a 2 step process

  1. Copy the file themes/beautifulhugo/layouts/index.html to layouts/index.html
  2. Edit this line in your newly created index.html so it uses .Params.description rather than .Params.summary (you may want to make it so the page falls-back to using .Params.summary in case the description isn’t set.

I didn’t know about index.html, thanks!

It worked. I copied themes/beautifulhugo/layouts/index.html to layouts/index.html and used the following code:

{{ if .Description }}

              {{ .Description | safeHTML }}
              <a href="{{ .Permalink }}" class="post-read-more">[{{ i18n "readMore" }}]</a>
            {{ else }}
              {{ if .Truncated }}
                {{ .Summary }}
                <a href="{{ .Permalink }}" class="post-read-more">[{{ i18n "readMore" }}]</a>
              {{ else }}
                {{ .Content }}`

Thanks a lot for your help!

1 Like