Using Hugo with IntelliJ IDEA

Went looking for help on a specific issue but couldn’t find anything:

Is there a plugin or other way to force IntelliJ IDEA Ultimate to treat .html files as Go templates. I installed the Go template plugin, but it expects Go templates to have the extension .gohtml. I wasn’t able to come up with a way to add or change the extension to .html without screwing up other aspects of IntelliJ. Seems like there are two options:

  1. Get a plug-in that works with .html but can tell the difference between a regular .html file and a Go template.

  2. Have some way to configure Hugo so that it accepts .gohtml as a Go template extension.


I propose a 3rd option: switch to Visual Studio Code and use the Hugo Language and Syntax Support plugin by @budparr :slightly_smiling_face:

1 Like

I’m gonna try it in my spare time, BUT switching IDEs isn’t easy. I’ve been using IntelliJ for several years for a variety of tasks. If I decide to use a different IDE to handle one situation, the switchover had better be worthwhile!

1 Like

I also stumbled upon this problem. I think making the filename extension of template files configurable would be the best option. This is not possible with Hugo yet?

I would be very happy if Hugo layout files could use the extension .gohtml instead of .html. There is an open issue about this:

Maybe plus-oneing (:+1:) it will help to make it happen?


There is an issue about it, which hasn’t been mentioned here