# How to render html content file as template?

**URL:** <https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392>\
**Category:** support\
**Created:** [September 6, 2022, 4:10am UTC](https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392 "2022-09-06T04:10:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![makoven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/makoven/32/17693_2.png) [@makoven](https://discourse.gohugo.io/u/makoven)\
**Post date:** [September 6, 2022, 4:10am UTC](https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392/1 "2022-09-06T04:10:02Z")

</div>

👋 I have home page layout file `layout/home.html` which contains:  
{{ define “main” }} {{ .Content }} {{ end }}

It normally displays the contents of file `content/_index.html`, but I would very much like it to not just display, but first render file `content/_index.html` as a template. Is it possible?

(inb: yes, there are shortcodes, but templates are more powerful)

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [September 6, 2022, 1:04pm UTC](https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392/2 "2022-09-06T13:04:51Z")

</div>

use a partial

> **[Partial Templates](https://gohugo.io/templates/partials/#readout)**
>
> Partials are smaller, context-aware components in your list and page templates that can be used economically to keep your templating DRY.

---

<div class="post-metadata">

**Author:** ![makoven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/makoven/32/17693_2.png) [@makoven](https://discourse.gohugo.io/u/makoven)\
**Post date:** [September 7, 2022, 12:12pm UTC](https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392/3 "2022-09-07T12:12:32Z")

</div>

Partials don’t work in a content files

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [September 7, 2022, 12:29pm UTC](https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392/4 "2022-09-07T12:29:58Z")

</div>

rename content/\_index.html to content/\_index.md

PS: you can set a specifier layout in frontmatter

---

<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:** [September 7, 2022, 3:55pm UTC](https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392/5 "2022-09-07T15:55:17Z")

</div>

> [@makoven](#):
>
> render file `content/_index.html` as a template. Is it possible?

No, it is not.

> [@makoven](#):
>
> yes, there are shortcodes, but templates are more powerful

I’m not sure what you mean by “templates are more powerful.” What do you want to do that cannot be accomplished with a shortcode?

---

<div class="post-metadata">

**Author:** ![makoven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/makoven/32/17693_2.png) [@makoven](https://discourse.gohugo.io/u/makoven)\
**Post date:** [September 7, 2022, 9:12pm UTC](https://discourse.gohugo.io/t/how-to-render-html-content-file-as-template/40392/6 "2022-09-07T21:12:50Z")

</div>

> [@jmooring](#):
>
> No, it is not.

it is sad

> [@jmooring](#):
>
> What do you want to do that cannot be accomplished with a shortcode?

at least I wouldn’t have to wrap all template/partial calls in inline shortcodes…
