I often use Visual Studio Code (VSCode) snippets for small bits of code and learned something exciting today:

Snippets can do more than insert static text and placeholders: it has variables that replace themselves with actual content when expanded.

There are variables for complete filenames, path parts, dates, and random values. The two that intrigue me most are a comment start and end variable, which output different values based on the current language.

Check out the complete list of VSCode snippet variables in the official documentation.


Credits for this discovery go to "Frontmatter Templates for New Blog Posts" by Cassey Lottman, where Cassey uses variables to generate a current date in Eleventy templates dynamically.