Feed Template Script

Review the feed template script, edit it with protection against block errors, see the diff and save, and revert to previous versions.

The Template script page is where you review and edit the content of an XML feed template. The script contains the XML skeleton of the feed file and embedded {{ … }} expressions (loops over products, conditions, product fields); the feed is generated according to this script each time. The page displays the script with syntax highlighting and matched blocks, protects editing against structural errors, and stores previous versions in history before each save.

Accessing the screen

On the Feed management screen, select the channel from the Channel selector, then click the Open script button in the relevant row of the XML templates table. The selected channel is transferred to this page.

If you can see the feed management screen, you can also view the script. Editing and restoring previous versions additionally require permission to modify the feed.

Screen sections

  1. Header: the template name with Template script below it. On the right, buttons for Back to feed management (returns to the previous page in the browser), History, and if you have permission, Edit. The Edit button is hidden while in edit mode.
  2. Shared template warning: if the template is used in multiple channels, a yellow banner states "This template is used in … channels (…); saving affects all." and lists the channel names.
  3. Script area: in view mode, toolbar, line-numbered script, and right sidebar; in edit mode, the editor.

Viewing the script

The page opens in script view mode and is not editable.

Toolbar

Item Function
Search in script (⌘F) Searches text in the script; case-insensitive. Matches are highlighted in yellow, the current match in dark yellow, and a counter like "3/12" appears ("0" if no matches). Enter goes to next, Shift+Enter to previous match; Previous / Next arrows do the same. Esc or Clear clears the search. ⌘F (Ctrl+F on Windows) focuses the search box.
Wrap Wraps long lines to fit the screen. Default is off.
Block indent Shows nested blocks with indent lines. Default is on.
Fold top blocks / Open all Hides the contents of outermost blocks; when folded, the button changes to Open all.
Blocks balanced / "… block error" Green badge indicates all blocks are properly closed. Red badge shows number of errors; clicking jumps to the first error line.
"… lines · … blocks" Number of lines and blocks in the script.
Copy Copies the entire script to clipboard; shows "Copied" notification.
Download Downloads the script as an XML file named after the template.
Full screen / Exit full screen Opens the script in full screen. Esc also exits.

Script area

  • Each line has a line number on the left. XML tags and {{ … }} expressions are shown in different colors.
  • A block is a section opened with {{for …}}, {{if …}}, {{while …}}, {{capture …}}, {{with …}}, {{case …}}, {{func …}}, {{tablerow …}} or {{wrap …}} and closed with …. Hovering over a block line highlights the block’s opening, any else/when, and end lines; clicking fixes the highlight.
  • Multi-line blocks have a Fold arrow on the opening line. Folded blocks show a "… N lines" badge; clicking the badge or Open arrow unfolds the block. If a search match is inside a folded block, it automatically unfolds.
  • Error lines are shown with a red background and a warning such as unclosed block (opened but not closed with end) or end without opener (extra … without opener).

Sidebar

Use the button in the sidebar to toggle between two views:

  • "Outline (…)": lists all blocks in the script. Each line shows the block’s start line and opening expression (e.g. for p in …), with nested blocks indented. Unclosed blocks have a red warning icon. Clicking an item scrolls the script to that line. If no blocks exist, it shows "No loops or conditions in template".
  • "Fields (…)": fields read by the template, grouped by variable name. If a variable comes from a loop, the list iterated over is shown as "← source" next to it. If a field is used multiple times, "×count" appears next to the name. Clicking a field searches for it in the script, helping you quickly see which product data is included in the feed and where it is used. If no fields exist, it shows "Template reads no fields".

Editing the script

This option appears only for accounts with permission to modify the feed; if you lack permission, the Edit button does not appear.

  1. Click the Edit button in the header. If the script is empty, you can also use the Edit button below the Script is empty message in the center.
  2. Make your changes in the editor:
    • Tab inserts two spaces; Enter creates a new line with the previous line’s indentation.
    • The current line is highlighted; the toolbar on the right shows the "Line …, Column …" position.
    • Lines do not wrap; scroll horizontally for long lines.
  3. Watch the badges in the toolbar: Unsaved changes / No changes and Blocks balanced / "… block error". If errors exist, red buttons appear below the toolbar for each error like "Line …: unclosed block"; clicking moves the cursor to that line.
  4. Click the Save button or press ⌘S (Ctrl+S on Windows).
  5. The Save changes window opens. It explains "Saving … affects the feed of the channel in the next generation. The previous version is backed up in history." and shows line diffs:
    • Added lines ("+… lines", green) and deleted lines ("−… lines", red) counts at the top.
    • Added lines have a green background with "+", deleted lines have a red background with "−"; old and new line numbers appear on the left.
    • Unchanged regions are collapsed with "… N unchanged lines" except for three lines around changes.
  6. Review the diff and click Save. To cancel, choose Cancel; you return to the editor.

Result:

  • On successful save, a "Template saved" notification appears and the page returns to view mode with the new script. If the script is unchanged from the server, the notification says "No changes".
  • The previous version is backed up in history; you can restore it from History if needed.
  • Changes take effect in the feed at the next generation.
  • If saving fails, a red "Template could not be saved" notification appears with the error explanation; your draft remains in the editor.

The Save button is disabled if no changes were made, if there are block errors in the script, or if a save is in progress. Scripts with block errors cannot be saved; this prevents broken templates from stopping feed updates.

Canceling editing

Click the Cancel button. If there are unsaved changes, you are asked "Discard changes?"; confirming deletes the draft and returns to the saved script.

If you try to leave the page with unsaved changes (e.g. via Back to feed management or menu), a prompt warns "Unsaved changes will be lost. Leave?". The browser also warns if you close the tab.

If someone else saves simultaneously

If another user saves the same template while you are editing, your save is rejected and a yellow banner appears: "The template was changed by someone else while you were editing. The latest version has been loaded; your draft remains — review the diff and save again." Your draft is not lost; when you click Save again, the diff is shown against the latest version. Review carefully to avoid overwriting others’ changes.

History and reverting to previous versions

The History window lists previous versions saved from the console before each save.

  1. Click the History button in the header.
  2. The left list shows each version with the date-time it was replaced by a newer one; the newest has a Latest badge. Below each entry is the user who saved it and the version size ("… · … bytes"). The newest version is selected by default.
  3. Click a version. On the right, it is compared to the current script: green "+" lines exist in the selected version but not in the current script; red "−" lines exist in the current script but not in the selected version.
  4. To revert to this version, click Load into editor. The window closes, the page switches to edit mode, and the version loads as a draft with a "Version loaded into editor; saving will revert." notification.
  5. Review the draft and save with Save. If you do not save, the revert does not occur.
  • Load into editor appears only for accounts with edit permission and is disabled if the selected version matches the current script. Without permission, you can only view history.
  • Loading a version from History during editing replaces your unsaved draft without prompt. Save your draft first if you want to keep it.
  • Close the window with Close to exit without changes.
  • Reverting is a normal save; the previous version before revert is also saved in history, so you can undo a revert.
  • If the list is empty, it shows "No saves yet": previous versions are kept from the first console save onward.

Common situations

  • I don’t see the Edit button. Your account lacks permission to modify the feed; you can only view, copy, and download the script.
  • Save button is disabled. Either no changes were made or there are block errors. Click the red "… block error" badge or "Line …" buttons to jump to errors; add missing … or remove extras.
  • Warning that the template is used in multiple channels appears. Changes affect feeds of all channels listed in the banner. Consult your system administrator if you want to change only one channel before saving.
  • I saved but the feed is still old. Changes apply at the next feed generation; immediate update is not expected.
  • "Script is empty" message appears. No script is saved for this template. If you have permission, create a new script with Edit.
  • "Feed service not configured" or "Something went wrong" messages appear. The first means feed setup is incomplete and retrying won’t help. For the second, click Retry; if it persists, report to your system administrator with the Technical detail text.

Related screens