Hugo doesn't serve HTML authored with MadCap Flare

I’m doing a bit of an experiment, and finding something that feels inconsistent:

I’ve built a bunch of .htm files using MadCap Flare. I then edit one of these built files to make use of Hugo templating lang (I added {{ lower "THIS IS MY TEST" }}.

When I run hugo server, it serves any markdown files on Content, but does not serve the Flare-built .htm files in there.

But when I run hugo, it copies the Flare output over to public, and processes the bit of Hugo templating language I added (so I get “this is my test” output)

It seems like Hugo should either:

  • Completely ignore everything except Markdown in Content
  • Serve all files in Content

I realise I’m doing something a bit odd. Does anyone have any explanation for what I’m seeing? Or any tips/guides for doing this type of project (taking a built output from elsewhere and adding it to Hugo) My end goal is some way to author in Flare but build in Hugo (or another static site generator)

Edit to add: even odder, it clearly looks at the .htm files when serving (I made a syntax error in the html and it logged out an error) so it’s clearly aware of the files, just not actually serving them.

Edit to add more: I tried setting frontmatter in the Flare files. This worked in the build (it applied the appropriate layout, stopped processing the lower test) but it still didn’t serve them - even though it’s definitely treating them like content at this point.

Have you used the unsafe parameter for Goldmark in the config?

I hadn’t - but went and tried it and it made no difference. Still doesn’t serve the .html files from Content, still DOES process them and include them in the build.

The really weird thing I think is that when I serve, it clearly watches the topic file (because changing something triggers a "source changed . . . " message. But it 404s when I try to view it.

Can you please share a repo? If not the actual one then a slimmed down version that reproduces the issue will do. Thanks.

Here’s the full thing: https://github.com/StarfallProjects/HugoFlare

I’ve been messing around a lot - at the moment, the .html files in content/flare don’t have frontmatter (but adding it doesn’t make any difference)

Hugo does process HTML files under content as long as front matter is provided.

However what I am seeing in your project does not really belong under /content/ since these HTML pages come along with their own JS & CSS assets.

I think that to have these pages served properly you need to place everything relevant under the /static/ folder.

That’s logical, but here’s the thing:

  • It DOES process them in the build, even without frontmatter, because it includes the shortcode
  • It DOESN’T process them to serve (at least not properly) even if I have frontmatter

For the thing I’m trying to do, I need Hugo to be able to process them - because I want to author the content in one tool, but wrap it in a bunch of Hugo shortcodes to handle the styling etc.

If Hugo can’t do that then cool - I realise I’m doing something that isn’t really intended/supported. But the confusing thing is it does do it when I build, just not when I serve.

Edit to add: quite a lot of the CSS and JS will be stripped out, I just haven’t got round to that yet (only started on it today, so working with a more or less default Flare output)

Well the pages may not be served properly in your browser since these pages are dependent to the various JS/CSS resources. When I tested placing everything under /static/ I noticed some redirects and missing asset paths.

I suppose that you can try combining the staticDir and contentDir folders in your project and see what happens.

But as you have figured out you are bypassing the default way that Hugo organizes assets. Not aware of the Flare tool but obviously you are trying to do something different.

So this custom setup is not really something we can help you with in this forum.

EDIT
Also I updated the topic title to make clear what this issue is about.

Thanks for taking the time to look & respond anyway.

Can you just confirm that the behaviour currently working for me (HTML files in content containing shortcodes getting built properly with hugo) is an intended, supported behaviour and won’t change? I guess it might be safer to add frontmatter . . .

Content files under the contentDir are the only place through which Hugo processes shortcodes.

But for this custom HTML setup you may need to use Shortcodes without Markdown since there is really no point adding an extra layer of processing.

Front matter is mandatory. There is a GitHub issue somewhere about removing the need to have front matter, but we are not there yet.

Thanks again.

Flare chokes on <>, hence using %% (not ideal I know)

It seems odd that it’s processing the html files even when they don’t have frontmatter then?

Hard to say.

For example your content directory contains another content directory under content/flare/Content/ and within it there are folders named resources, also you have a folder called data under content/flare/data.

These are reserved folder names so unpredictable things may happen.

This topic was automatically closed after 23 hours. New replies are no longer allowed.