Visual Studio snippets for the FreeMarker templating language. The snippets work in .ftl
files.
Freemarker Snippets HTML Snippets Magnolia Snippets
Note: All output examples below have dummy data, in curly bracket (i.e. {variableName}
), that represent tab stops, to show you how it should display.
All ftl commands have a arrow wrapper option <>
with a similar prefix.
[#include "{/path/to/include}"]
[@{macroName} {argument=argumentValue} /]
[#macro {macroName} {arguments=withDefaultValue}]
{code}
[/#macro]
[#if {statement}]
{code}
[/#if]
[#if {statement}?has_content]
{code}
[/#if]
[#if {statement}]
{code}
[#else]
{code}
[/#if]
[#if {statement}]
{code}
[#elseif {statement2}]
{code}
[/#if]
[#else]
[#elseif {statement}]
[#switch {variable}]
[#case {value1}]
{code}
[#break]
[/#switch]
[#case {value}]
[#break]
[#{tagName}]
[/#{tagName}]
${$0}
[#assign {nameOfVariable = value}]
[#local {nameOfVariable = value}]
Add a period ".
" to the end of any html snippet to add a class property (e.g. "section.
" outputs <section class=""></section>
).
Snippet | Has Class | Output |
---|---|---|
section | ✔ | <section></section> |
header | ✔ | <header></header> |
main | ✔ | <main></main> |
div | ✔ | <div></div> |
form | ✔ | <form id="{id}" action="{action}" method="{method}"></form> |
input | ✔ | <input id="{name}" name="{name}" type="{type}" value="{value}" /> |
span | ✔ | <span></span> |
h1 | ✔ | <h1></h1> |
h2 | ✔ | <h2></h2> |
h3 | ✔ | <h3></h3> |
h4 | ✔ | <h4></h4> |
p | ✔ | <p></p> |
strong | ✔ | <strong></strong> |
a | ✔ | <a href="{href}"></a> |
button | ✔ | <button></button> |
img | ✔ | <img src="{src}" alt="{alt}" title="{title}"> |
meta | <meta property="{property}" content="{content}"> |
|
link | <link rel="{rel}" href="{href}"> |
|
script | <script type="{type}" src="{src}"></script> |
|
script# | <script id="{id}" type="{type}" src="{src}"></script> |
|
script:block | <script></script> |
|
class | class="" |
|
href | href="" |
|
style | style="" |
|
role | role="" |
|
alt | alt="" |
|
title | title="" |
|
src | src="" |
cmsfn.{option}()
- options:
- children
- contentByPath
- contentById
- contentListByTemplateId
- page
- link
- externalLink
- externalLinkTitle
- linkPrefix
- localizedLinks
- asContentMap
- asJCRNode
- asNodeList
- ancestors
- parent
- root
- siteRoot
- dump
- isEditMode
- isPreviewMode
- isAuthorInstance
- isPublicInstance
- decode
- abbreviateString
- queryStringAndFragment
- language
- wrapForI18n
- isCurrentLocale
- metaData
- fileExtension
- readableFileSize
Outputs Magnolia cmsfn.dump()
templating function.
${cmsfn.dump({object_to_dump}, 3 , true)}
[#list components as component]
[@cms.component content=component /]
[/#list]
[@cms.area name="{areaName}" /]
Adds arrow wrapper <>
option snippets for all ftl commands
Adds form
and input
tag snippets
Adds button
tag snippets
Sets default depth
and asHtml
arguments of cmsfn.dump()
snippet.
Adds snippets for the following HTML tags: span, a tag with class, image tag with class, meta, link, script (script, script with id, and script block). Updates the README to indicate which html tags have a 'with class' variant.
Updates README
Updates README with better documentation and adds demo.
Fixes switch statement last tab stop.
Adds the switch, case, break, and elseif snippets.