Running a LocomotiveCMS site? We can host and maintain it for you. Contact us →

Actions API

Introduction

The action liquid tag allows LocomotiveCMS developers to run secure javascript code on the server side.

What's the Javascript engine powering Actions?

No Google V8, no JavaScriptCore, no SpiderMonkey. Instead, we use Duktape, a lightweight and portable engine with Ruby bindings.

Here is a list of its capabilities:

  • read and write Liquid variables of the current context
  • read and write session variables
  • built-in functions to read/create/update content entries
  • built-in functions to send emails

Example:

Hello world

{% assign string = 'Hello' %} {% action "send an email to each " %} var string = getProp("string"); string += ' world!'; setProp("string", string); {% endaction %} <p>{{string}}</p>