Configure HTML files in IntelliJIDEA to recognize HUGO's GO Templates

Written by Lyoneel on in HUGO, IntelliJ Platform
 2 mins

Configure HTML files in IntelliJIDEA to recognize HUGO's GO Templates

Jetbrains IDEs are a huge monster with everything you need. But sometimes it becomes difficult to do small things, like in this case, recognise HTML files as GO templates. From here you have two options…

File specific configuration

If you have one or few-specific files, you can just turn the syntax highlighting only to those files without affecting the global configuration.

You have to do right-click on the desired file, and then use the option Override File Type

image of a right-click menu when is clicked over a file inside IntelliJIDEA IDE file tree

After you click on the Override option, a dialogue will pop out.

image of type selection menu after “override file type” option is executed

Scroll down until you find the type you desire, for this explanation will pick Go Template

As you can imagine, you should do this operation on every file, and if by file basis is not good to you, keep reading.

Global configuration

To modify global configuration for the Hugo’s Html GOTemplates you have to go to menu File -> Settings...

settings file type dialog

Then you have to click in + button and add *.html, and leave blank the second field, press ok, you may be asked if you want to override the association, override it.

settings file type dialog for adding a new pattern

Now you should find visual change on icons and, of course, syntax-highlighting.


Thanks for reading!

Namaste.