# How can I conditonally show the "Summary"?

**URL:** <https://discourse.gohugo.io/t/how-can-i-conditonally-show-the-summary/48484>\
**Category:** support\
**Created:** [February 24, 2024, 11:58pm UTC](https://discourse.gohugo.io/t/how-can-i-conditonally-show-the-summary/48484 "2024-02-24T23:58:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ife](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ife/32/21421_2.png) [@Ife](https://discourse.gohugo.io/u/Ife)\
**Post date:** [February 24, 2024, 11:58pm UTC](https://discourse.gohugo.io/t/how-can-i-conditonally-show-the-summary/48484/1 "2024-02-24T23:58:15Z")

</div>

I’m building my theme from scratch. On some pages like blog posts, I want to show a summary. On some pages like projects and contact, I don’t want a summary because it makes no sense.

My front matter:

```auto
---
title: 'Projects'
date: 2024-02-24
lastmod: 2024-02-24
draft: true
tags: []
summary: ""
---

```

The relevant part of single.html:

```auto
{{if not (eq .Summary "")}}
<p> {{ .Summary }}</p>
{{end}}

```

_I know I can use ne, but this reads better for me_

For the front matter above, shouldn’t the if statement be false? Rather, if summary is left empty, it instead uses the first few words of the remaining markdown. If I set summary to be empty, I don’t want it to show, at all.

From this page as well: [Content summaries | Hugo](https://gohugo.io/content-management/summaries/#summary-selection-order), it seems hugo **ALWAYS** needs a summary, and it automatically gets one if it can’t find one

How can I get around this? I can replace `""` with `" "` and just check for `" "` instead but that just seems hacky. Is that my only option?

Thanks

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 25, 2024, 1:11am UTC](https://discourse.gohugo.io/t/how-can-i-conditonally-show-the-summary/48484/2 "2024-02-25T01:11:52Z")

</div>

Posts, projects, and contact are three different [content types](https://gohugo.io/getting-started/glossary/#content-type). Conditionally display the summary based on content type.

See [https://gohugo.io/methods/page/type/](https://gohugo.io/methods/page/type/).

---

<div class="post-metadata">

**Author:** ![Ife](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ife/32/21421_2.png) [@Ife](https://discourse.gohugo.io/u/Ife)\
**Post date:** [February 25, 2024, 4:06am UTC](https://discourse.gohugo.io/t/how-can-i-conditonally-show-the-summary/48484/3 "2024-02-25T04:06:02Z")

</div>

Thank you so much for that! I don’t know how I didn’t find it sooner. Hugo makes more sense now.

Most of the tutorials/articles I saw just kept everything in the \_defaults folder without any extra info so I just assumed everything goes there.

My project is now well structured properly (I hope)

I’m deleting the \_defaults folder and explicitly specifying which type/layout to use in the archetypes
