Izvēlieties valodu

Semantyca NM for Joomla Versija 1.0

6. nodaļa

Templates

Templates for website content and bespoke content, and how to edit them.

A template defines how a newsletter looks and which inputs the composer offers. Templates can pull in website articles, hold entirely bespoke content, or mix both, so one system covers digests, announcements, invitations and any other e-mail you send regularly.

Website content or bespoke content

Every template declares its own fields. A field of type Articles lets editors pick articles from the site; the template then renders their titles, intro texts, images and links. All other field types (Text, Rich text, Image, URL, Colour palette …) hold content that has nothing to do with the website. You decide the mix:

  • Content-driven: a monthly digest with a banner, a highlighted lead article and a list of further articles.
  • Bespoke: an announcement with a heading, an image, a message and a button. No articles involved.
  • Mixed: an editorial written for the newsletter, followed by the latest articles and an events box.

A fresh installation includes two starter templates that show both approaches: Article digest (articles) and Announcement (bespoke content).

The Templates screen

Open Components → Semantyca → Templates.

Templates screen listing four templates with their field names, the number of newsletters using each and an Export button per row
Templates with their fields and the number of newsletters that use them.
  • Fields lists the variable names the template provides; Used by counts the newsletters based on it.
  • Export (per row) downloads the template, including its fields, as a .json file you can import on another site.
  • Import uploads a Semantyca template file (.json). Exports from the earlier Semantyca NM are accepted too.
  • Actions publishes, unpublishes or trashes the selected templates. Only published templates can be chosen in the composer.
Templates contain executable EJS code that runs in the editor's browser. Creating, importing and editing template code therefore requires the Edit template code permission (Options → Permissions). Users without it can still rename and describe templates. Only import templates from sources you trust.

Create or edit a template

  1. Click New, or click a template title.
  2. On the Template tab enter a Title, a Description (shown under the template picker in the composer) and the template code.
  3. On the Fields tab add one row per input the composer should show.
  4. Optionally enter an outer layout on the Wrapper tab.
  5. Open the Preview tab and click Refresh preview to render the unsaved template with sample articles and the field defaults.
  6. Click Save or Save & Close.
Edit template screen with the Announcement template code in the code editor and the cheat sheet on the right
The template code with the cheat sheet of EJS syntax and merge tags.

Fields

Each field becomes an input in the composer and a variable in the template code.

Fields tab of the Announcement template listing logo, heading, image, body, buttonLabel, buttonUrl and accent with their labels and types
The fields of the bespoke Announcement template.
ColumnDescription
Variable nameName used in the code, for example heading for <%= heading %>. Use letters, digits and underscores, starting with a letter (it must be a valid JavaScript name).
LabelCaption shown in the composer.
TypeThe kind of input (see below).
DefaultInitial value for new newsletters. For a colour palette, list colours separated by commas, for example #003384, #AEC300.
TypeComposer inputValue in the template
TextSingle-line textString
Multi-line textText areaString
Rich textVisual editor with HTML view and merge-tag buttonHTML string (output with <%-)
NumberNumberNumber
URLWeb addressString
ImageAddress with Choose image (Media Manager)Image URL
Colour paletteColour swatches with + ColourArray of colour codes
ArticlesArticle pickerArray of article objects

For the template syntax, the article object and the wrapper, see Template language reference.

Atjaunināts 16 novembris 2026