Short Codes

Short codes are small text snippets that can be entered into any page via the code widget or the various text Brics that come with Blocs. When a project is exported, these codes are replaced with common project variables such as the page name, title or base url. Short codes can be really useful when developing custom Blocs, Brics and page templates.

Page Details

%pageName% – Page Name
%pageTitle% – Page Title
%pageFileName% – Page File Name
%keywords% – SEO Keywords
%description% – SEO Description
%pageURL% – Page URL
%pagePathLevel% – Page path prefix based on level e.g. (../).

Beginner tip

The page path level short code (%pagePathLevel%) is only populated on export.

Site Details

%baseURL% – Base URL

Beginner tip

The base url and page url short codes require that the web address url in project settings is populated.

Ecommerce

%ecwidStoreID% –  Ecwid Store ID – Project Settings
%paddleUserID% –  Paddle User ID – Project Settings
%snipcartApiKey% –  Snipcart Api Key – Project Settings
%stripeUserID% –  Stripe User ID – Project Settings

Misc

%isPreview% –  Identify Preview Mode
 

Using Short Codes in Custom Bric Template Files

When using short codes within a custom Bric template file, developers should write their template code to take into consideration the likelihood of a custom Bric being added in the global area, causing the template file to be used by every page on the site. This will naturally affect the page specific short codes. If a page short code (%pageName%) is used in a template file that is placed within a Global area, upon export the value will be blank.

Updated on 19th January 2023

Was this article helpful?

Related Articles