Which templates do you prefer "Velocity" or "SOY"?

Gregor Kasmann_Actonic
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 20, 2017

As you know Confluence add-on may be built using "Velocity" (https://developer.atlassian.com/confdev/development-resources/confluence-architecture/confluence-internals/velocity-template-overview) or "SOY" (https://developer.atlassian.com/confdev/tutorials/writing-soy-templates-in-your-plugin) templates.
Which one do you prefer and why?
Which would you advise to use for a large project, built on the Confluence API?

1 answer

0 votes
Adrien Ragot (Requirement Yogi)
Contributor
October 23, 2019

You won't usually have much choice. Generally:

  • The initial result of actions (xwork or webwork) is generally* displayed with Velocity,
  • Only SOY templates can be used for client-side rendering, for example in JS when you need to render a subset of the page. Note that SOY templates can also be used on the server-side, that is why they exist.

So, most plugins have both. If you do succeed to use SOY everywhere:

  • (+) You'll have only one template to teach your colleagues/employees,
  • (-) If you want to build a page that has similar features as one in the core of Confluence, you won't be able to start with copy-pasting the .vm code. You'll have to translate it into .soy, and it will be error-prone.
  • (-) I don't know what is the performance of server-side rendering of Soy and Velocity, but I don't suspect you can do better than Velocity.

So... most plugins keep both templates.

*although it seems you can display the result of an action using Soy, according to this excerpt from the source of Confluence:

<result name="success" type="soy">
<param name="location">confluence.web.resources:auditlog/Confluence.Templates.Auditing.Page.auditLogPage</param>
</result>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events