# Internal-comment shortcode

**URL:** <https://discourse.gohugo.io/t/internal-comment-shortcode/6694>\
**Category:** tips & tricks\
**Created:** [May 23, 2017, 7:44pm UTC](https://discourse.gohugo.io/t/internal-comment-shortcode/6694 "2017-05-23T19:44:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharonl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/sharonl/32/3236_2.png) [@sharonl](https://discourse.gohugo.io/u/sharonl)\
**Post date:** [May 23, 2017, 7:44pm UTC](https://discourse.gohugo.io/t/internal-comment-shortcode/6694/1 "2017-05-23T19:44:13Z")

</div>

I created a `comment` shortcode for internal comments that are excluded from the HTML output and page source.

**Shortcode Definition (layouts/comment.html)**

```auto
{{ if 0 }}{{.Inner}}{{ end }}

```

**Shortcode Usage**

```auto
{{% comment %}}Internal comment{{% /comment %}}

```

**Note**  
I read on the discussion forum that by default, Hugo removes HTML comments from the output. However, in my tests HTML comments in Markdown files appear in the output page source?  
Regardless, you might prefer no to use HTML comment syntax even if it is entirely excluded from the output — for example, if you want to use nested HTML comments in your comment.

---

<div class="post-metadata">

**Author:** ![sharonl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/sharonl/32/3236_2.png) [@sharonl](https://discourse.gohugo.io/u/sharonl)\
**Post date:** [August 29, 2018, 9:32pm UTC](https://discourse.gohugo.io/t/internal-comment-shortcode/6694/2 "2018-08-29T21:32:53Z")

</div>

There’s a typo in the shortcode implementation in the original post; I’m unable to edit it now, so this is the correct implementation:

```auto
{{ if 0 }}{{.Inner}}{{ 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:** [August 30, 2018, 1:57am UTC](https://discourse.gohugo.io/t/internal-comment-shortcode/6694/3 "2018-08-30T01:57:49Z")

</div>

> [@sharonl](#):
>
> unable to edit it now

Edited
