Render a page with multiple layouts

Hey, so I don’t know whether to file this as a feature request or if something like this already exists.

Consider something like AMP or feature phone pages, where a page has to be rendered differently. It’s an “alternate form” of some sort (and, accordingly, the page usually <link>s to the canonical page.

Is there a way to render content in Hugo using multiple layouts? The goal would be to have two different output HTML pages, one canonical one and another in a different format.

I believe there’s nothing to do that specifically with hugo right now. If you need a lighter copy of your website, how about rendering the content with 2 different themes? And maybe have a mobile specific sub-domain the user gets redirected to, like some companies have.

I’m curious though: in practice, is it often useful? Even a pretty big framework like bootstrap or foundation seems to work well on mobiles.

Best, Nathan.

Hmm, using two themes might work. I’ll have to see.

As for in practice, yes and no. It’s only for very specific scenarios. Our site using Bootstrap, so it works fine on its own on mobile and similar platforms. I’m mainly targeting situations in which you absolutely need a separate page, such as AMP.

Yeah, in that case, I’d use a tool like bvckup to mirror the content folder to a second website project folder, and generate both websites with a batch file. It should be a 1 step process that way.