# Unable to use Output Formats

**URL:** <https://discourse.gohugo.io/t/unable-to-use-output-formats/24475>\
**Category:** support\
**Created:** [April 5, 2020, 8:14am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475 "2020-04-05T08:14:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SanmayJoshi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/sanmayjoshi/32/9451_2.png) [@SanmayJoshi](https://discourse.gohugo.io/u/SanmayJoshi)\
**Post date:** [April 5, 2020, 8:14am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/1 "2020-04-05T08:14:28Z")

</div>

## Objective:

I wanted content files to render as per specified layout (which they do) and in specific extension (here `md`).

## What I tried:

1. **`config.toml`**

```auto
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
uglyurls = true

# Change the suffix of the HTML output format from html (default) to md
[mediaTypes]
  [mediaTypes."text/html"]
    suffixes = ["md"]

# Redefine HTML to update its media type.
[outputFormats]
  [outputFormats.HTML]
    mediaType = "text/html"

```

2. **`config.toml`**

```auto
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
uglyurls = true

# There was a note on https://gohugo.io/templates/output-formats saying:
# Note that for the above to work, you also need to add an outputs definition in your site config.
# Didn't understand it properly, but I think this is what it meant.
# Please correct me if wrong.
[outputs]
  page = ["HTML"]

# Change the suffix of the HTML output format from html (default) to md
[mediaTypes]
  [mediaTypes."text/html"]
    suffixes = ["md"]

# Redefine HTML to update its media type.
[outputFormats]
  [outputFormats.HTML]
    mediaType = "text/html"

```

3. **`config.toml`**

```auto
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
uglyurls = true

```

## Expected result:

Files appear in public directory (in proper subfolder) with extension `.md`

## Actual result as per `What I tried`, in respective manner:

1. No files (or pages) appear other than taxonomy pages (and folder)
2. No files (or pages) appear other than taxonomy pages (and folder)
3. Files appear with extension `.html` (though it is not what I wanted, it is working as it should)

Please help

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [April 5, 2020, 9:49am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/2 "2020-04-05T09:49:16Z")

</div>

If I’m understanding you correctly, you probably want something like this:

```auto
[outputs]
  home = ["MD"]

[outputFormats]
  [outputFormats.MD]
    baseName = "index"
    isPlainText = true
    mediaType = "text/markdown"

[mediaTypes]
  [mediaTypes."text/markdown"]
    suffixes = ["md"]

```

---

<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:** [April 5, 2020, 9:49am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/3 "2020-04-05T09:49:17Z")

</div>

You should extend the [outputs] , look here

> **[Custom Output Formats](https://gohugo.io/templates/output-formats#output-formats-for-pages)**
>
> Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.

I defined different outputs im my sample here

> <https://github.com/gj52/HugoSample/blob/master/config/_default/config.toml>

---

<div class="post-metadata">

**Author:** ![SanmayJoshi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/sanmayjoshi/32/9451_2.png) [@SanmayJoshi](https://discourse.gohugo.io/u/SanmayJoshi)\
**Post date:** [April 6, 2020, 6:16am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/4 "2020-04-06T06:16:30Z")

</div>

@pointyfar Thanks for the input. But when I adjust config file as per your suggestion, in output files (pages) have the .html extension.

> If I’m understanding you correctly

What I am trying to do is to have the generated pages to have .md extension.

@ju52 Thanks for the help. I had actually gone through the link you provided (from where I have quoted the note in point 2 of `what I have tried`).

What I am trying to do is to have generated pages to have .md extension. How may I declare output formats in config file? I think I should be concentrating on `page` in:

```auto
# quoted from https://github.com/gj52/HugoSample/blob/master/config/_default/config.toml
# on line no. 137 (at commit https://github.com/gj52/HugoSample/commit/0231cb59be80b8d70273ee1a09e297ed94f91539,
# just in case file changes in future)
[outputs]
    home = ["HTML", "ATOM", "JSON", "FEED", "MANIFEST", "SITEMAP"]
    section = ["HTML", "SITEMAP"]
    page = ["HTML"]
    taxonomy = ["HTML"]
    taxonomyTerm = ["HTML"]

```

* * *

Thoughts?

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [April 6, 2020, 7:30am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/5 "2020-04-06T07:30:24Z")

</div>

Do you have your site code somewhere we can have a look at? It would be easier to help you if we can see what you are doing.

---

<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:** [April 6, 2020, 12:39pm UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/6 "2020-04-06T12:39:53Z")

</div>

You MUST create the correct templates for it!  
Try to create a layouts/index.md template.

look here

> **[Custom Output Formats](https://gohugo.io/templates/output-formats/#templates-for-your-output-formats)**
>
> Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.

---

<div class="post-metadata">

**Author:** ![SanmayJoshi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/sanmayjoshi/32/9451_2.png) [@SanmayJoshi](https://discourse.gohugo.io/u/SanmayJoshi)\
**Post date:** [April 7, 2020, 9:36am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/7 "2020-04-07T09:36:54Z")

</div>

Awesome!  
I just changed the extension of my template file from `.html` to `.md`. It worked.

Current config.toml:

```auto
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
uglyurls = true

[outputFormats]
  [outputFormats.MD]
    baseName = "index"
    isPlainText = true
    mediaType = "text/markdown"

[mediaTypes]
  [mediaTypes."text/markdown"]
    suffixes = ["md"]

[outputs]
  page = ["MD"]

```

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [April 9, 2020, 9:36am UTC](https://discourse.gohugo.io/t/unable-to-use-output-formats/24475/8 "2020-04-09T09:36:58Z")

</div>

Closed on April 9, 2020, 9:36am UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
