2 Html files from 1 markdown

Hi,
Is there any way to create 2 HTML files from 1 MD file?
I would Like to generate my posts like normal and another file with just the Page Title.
Any way to do that?

1 Like

Have a look at Output Formats: Custom Output Formats | Hugo

with outputFormats you have to use different file extensions, ex. html and htm to use different templates for generation

I needed different JSON and XML outputs , compare my theme config
and the different template names

I think the outputFormats require multiple file types.
But what I need is HTML outputs at 2 locations.

config.toml

[outputFormats.title-only]
mediaType = "text/html"
baseName = "index-title-only"

[outputs]
page = ['HTML','title-only']

layouts/_default/single.title-only.html

{{ define "main" }}
  <h1>{{ .Title }}</h1>
{{ end }}

publish directory

public/
ā”œā”€ā”€ post/
ā”‚   ā”œā”€ā”€ test/
ā”‚   ā”‚   ā”œā”€ā”€ index.html
ā”‚   ā”‚   ā””ā”€ā”€ index-title-only.html
ā”‚   ā””ā”€ā”€ index.html
ā””ā”€ā”€ index.html
3 Likes

Thank You man!
This worked

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