Adding a debug output format to a theme

I’m trying to set up a template path that allows me to easily view and debug content associated with a post.

What I want is to have two pages for each post

  • /2023/08/08/slug.html - the content of the post
  • /debug/2023/08/08/slug.html - debug info for the post

I’ve verified this works in Hugo (0.91.0) on my local machine by updating the config to include new mediaType and outputFormats params and adding the new output format for pages.

{
        …
	"mediaTypes": {
		"application/json": {
			"suffixes": [
				"json"
			]
		},
		"text/debug": {
			"suffixes": [
				"debug.html"
			]
		}
	},
	"outputFormats": {
		"DEBUG": {
			"name": "DEBUG",
			"mediaType": "text/debug",
			"path": "debug",
			"isHTML": true
		},
                …
	},
	"outputs": {
                 …
		"page": [
			"HTML",
			"DEBUG"
		]
                 …
	}
}

On my local install if inspect the output formats on a post, I can see permalinks for the HTML URL and the corresponding debug URL, but publishing the same code to Micro.blog only shows the permalink for the HTML format.

How can I accomplish this on Micro.blog? Is there only a subset of the Hugo config options that can customized?

Yes, Micro.blog has a limited set of config options it allows, mostly for security. I think the config you have should be okay, so I’ll add those later today. Sorry for the confusion while you were troubleshooting this.

No worries! Thanks for letting me know (and adding those options :slight_smile: ).

I see that the config options that can be customized are documented here, but I think I overlooked it thinking it was only relevant to the params object.

I’ve added those extra fields and updated the documentation. Let me know if it doesn’t work.

Works beautifully. Thank you!