# \[Proposal\] Custom Output Formats

**URL:** <https://zola.discourse.group/t/proposal-custom-output-formats/68>\
**Category:** Uncategorized\
**Created:** [March 7, 2019, 12:56am UTC](https://zola.discourse.group/t/proposal-custom-output-formats/68 "2019-03-07T00:56:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulcmal](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/paulcmal/32/32_2.png) [@paulcmal](https://zola.discourse.group/u/paulcmal)\
**Post date:** [March 7, 2019, 12:56am UTC](https://zola.discourse.group/t/proposal-custom-output-formats/68/1 "2019-03-07T00:56:16Z")

</div>

Hi, following discussion on the [bugtracker](https://github.com/getzola/zola/issues/365), i took a little time to explicit what custom output format support could look like in Zola.

It’s all taking place on [a pad](https://lite1.infini.fr/p/gutenberg-cof) following cooperation guidelines proposed on the bugtracker ⁽¹⁾ (these can of course be question and amended).

If something on the pad is not clear please point it out. I intend this draft document to slowly evolve into the actual documentation page about this particular feature.

Feel free to provide constructive criticism and outrage if i missed some obvious issue 🙂

⁽¹⁾ Sorry i can’t post more than two links in a post as my account is new so you’ll have to search the page for “those guidelines”.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [March 26, 2019, 5:46pm UTC](https://zola.discourse.group/t/proposal-custom-output-formats/68/2 "2019-03-26T17:46:05Z")

</div>

Now that 0.6 is out of the door we can look at that, I didn’t forget about it!

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [March 28, 2019, 7:00pm UTC](https://zola.discourse.group/t/proposal-custom-output-formats/68/3 "2019-03-28T19:00:08Z")

</div>

Ok I understand better custom output formats now.

It does make sense to support that I think if we can make it easy to do so and it looks easier to implement than I thought.

Does anyone know open-source projects using them a lot in Hugo or something similar to see some use in real life?

---

<div class="post-metadata">

**Author:** ![paulcmal](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/paulcmal/32/32_2.png) [@paulcmal](https://zola.discourse.group/u/paulcmal)\
**Post date:** [May 21, 2019, 11:23am UTC](https://zola.discourse.group/t/proposal-custom-output-formats/68/4 "2019-05-21T11:23:48Z")

</div>

> [@keats](#):
>
> Does anyone know open-source projects using them a lot in Hugo or something similar to see some use in real life?

I guess [this is](https://forestry.io/blog/search-with-algolia-in-hugo/) a very common pattern of what you would do with it. Apart from this, i unfortunately don’t have any **source** to show interesting examples :-/

> [@](#):
>
> if we can make it easy to do so

I don’t think it would be so much harder to implement from scratch. The main issue i see is the current codebase has hardcoded defaults for HTML/RSS output and so we need to come up with some more generic logic. Or am i missing something?

In my opinion, “content kinds” (i.e. page/section templates) are a very useful mental tool to make custom output formats easier to implement and to use for website admins, because usually you only change output formats for a different content kind (like adding iCal output for “events” content kinds) or site-wide (like for RSS, or Algolia in the previous example).

---

<div class="post-metadata">

**Author:** ![distransient](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/distransient/32/1469_2.png) [@distransient](https://zola.discourse.group/u/distransient)\
**Post date:** [May 24, 2025, 9:11pm UTC](https://zola.discourse.group/t/proposal-custom-output-formats/68/5 "2025-05-24T21:11:41Z")

</div>

Hello.

Apologies for bumping an ancient thread. However, I looked at the code for this and it would be very simple to implement in a reverse-compatible way, which I would be willing to submit as a PR if it is agreeable, since I find it personally quite useful.

1. Add an option to the Config main section called `template_extensions`, with the type `Vec<String>` and a default value of `vec!["*ml".to_string(), "md".to_string(), "txt".to_string()]` (`components/config/src/config/mod.rs`).
2. Update the template glob pattern to use this configuration value instead of the hardcoded extensions (`components/templates/src/lib.rs`).
3. Update the Configuration doc page to reflect the added option (`docs/content/documentation/getting-started/configuration.md`).
4. Add the `filename` frontmatter property as described in: [Non-Standard Template Extensions | Template Extensions other than .html | Functionality akin to resources.ExecuteAsTemplate and resources.FromString in Hugo - #11 by sirinath](https://zola.discourse.group/t/non-standard-template-extensions-template-extensions-other-than-html-functionality-akin-to-resources-executeastemplate-and-resources-fromstring-in-hugo/621/11) (`components/content/src/front_matter/page.rs`)
5. Handle the filename property when rendering (`components/site/src/lib.rs`)
6. Describe the added frontmatter value in the docs (`docs/content/documentation/content/page.md`)

Since the configuration value default would have the existing hardcoded value, it would not change the behavior of existing websites on upgrade. This change would also be unobtrusive and local (doesn’t affect other existing functionality), with a nice value-add, in my opinion.

I’ve published the following branch with the above changes:

> **[GitHub - distransient/zola at output-formats](https://github.com/distransient/zola/tree/output-formats)**
>
> output-formats

Let me know what you think.

(PS: The pad posted by OP is no longer accessible.)

---

<div class="post-metadata">

**Author:** ![distransient](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/distransient/32/1469_2.png) [@distransient](https://zola.discourse.group/u/distransient)\
**Post date:** [May 30, 2025, 10:14pm UTC](https://zola.discourse.group/t/proposal-custom-output-formats/68/6 "2025-05-30T22:14:31Z")

</div>

I rebased the branch against `next` and after testing with a toy folder I’m running into a handful of issues that would need to be fixed for this to really be useful:

1. Content from markdown is only available rendered in html, and the content’s markdown text, let alone the syntax tree of the content, is not available in the template. So unless you’re just rendering html that doesn’t use the filename html, you’re probably best off leaving the content empty then and putting whatever you want rendered into the frontmatter only.
2. Even though a directory’s pages have `in_search_index = false`, the folder will still show up in the `sitemap.xml`. _This **might** be an unrelated existing issue_, _ **or** _ it could be a quirk of my own changes. Regardless, with the brief time I spent looking at sitemap generation, I didn’t really understand how it was working, so I would need to look more to figure out which is the case.

These changes could still be useful, but as it stands, probably shouldn’t be seen as a user-friendly path to rendering anything that isn’t basically html anyways.
