Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Hugo Language and Syntax SupportNew to Visual Studio Code? Get it now.

Hugo Language and Syntax Support

budparr

|
61,994 installs
| (5) | Free
Adds syntax highlighting and snippets to Hugo files in VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

language-hugo README

Syntax highlighting and snippets for Hugo websites.

Features

Makes Hugo templating fit in with the rest of your HTML.

Includes 24 completion snippets for Go Template, see full list below.

Includes snippets for Hugo Shortcodes in Markdown and TOML file, list to come.

Template Snippets

Snippet Tab Trigger Output
Curlies x {{ }}
Dot xx {{ . }}
If if {{ if }} {{ end }}
If Inline ifi Same as above but inline
If/Else ife {{ if }} {{ else }} {{ end }}
If/Else if ifei {{ if }} {{ else if }} {{ end }}
With with {{ with }} {{ end }}
With/Else withe {{ with }} {{ else }} {{ end }}
Range range {{ range }} {{ end }}
Partial partial {{ partial "" . }}
partialCached partialc {{ partialCached "" . variant }}
Naked partial xpartial partial "" .
Block block {{ block "main" . }} {{ end }}
Block define define {{ define "block" }} {{ end }}
Scratch  scra {{ .Scratch.Set|Get|Add|SetInMap|Delete|GetSortedMapValues }}
String str {{ printf "Something about %s" . }}
printF  print  printf "%s|%v|%d|%x" .
Variable vars {{ $var := what }}
Return  ret  {{ return $return }}
Debug debug {{ printf "%#v" . }}
Error error {{ errorf "%#v" . }}
Comment comm {{/* */}}

Known Issues

For Hugo Shortcode snippets to work in your Markdown files, enable quickSuggestions in your User Settings

"[markdown]": {
  "editor.quickSuggestions": true
}

Release Notes

See the Changelog

Roadmap

  • More Snippets/Completions
  • Add syntax highlighting for shortcodes in markdown files.
  • Add support for Hugo syntax highlighting in JSON files

Acknowledgments

Thank you to Matt Stratton for creating the Atom Language-hugo plugin, from which this borrows heavily.

Thank you to Steve Francia, Bjørn Erik and the Hugo community of contributors and users.

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft