Is it possible to add a shortcode into HTML file?

Hello,

I am new to the community and to Hugo. i am creating a theme from scratch and have added a shortcode for responsive images. I would like to add this shortcode into an html file (homepage) is this possible or must I add it into a .md file?

thank you,

I think so.

HTML is a supported content format along with Markdown provided that there is a front matter.

Also I would think that it would be preferable to use the <> delimiters in the shortcode input so that the HTML parser is used for processing. Also see: Use Shortcodes

If you want to use a snippet in your layouts, then you are in need of a partial instead of a shortcode.

Let’s say that your snippet is layouts/partials/sayhello.html:

<p> Hello! I was a partial called from {{.Page.File}} </p>

To use the partial at a given layout (e.g. layouts/posts/single.html) you’d write the following:

{{ partial "sayhello.html" . }} 

The dot means that you are passing the information about the Page so that your partial can use it. You can also pass and return variables.

More info at https://gohugo.io/templates/partials/