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. (../).
Site Details
%baseURL% – Base URL
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
Social Accounts
%xUserName% – X (Formally Twitter) Username – Project Settings
%facebookUserName% – Facebook Username – 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.
Using Short Codes in Global Areas
Blocs has support for using short codes in Global Areas, however, any page detail short codes that are placed in either of the Global Areas will be removed and not rendered when a site is exported or previewed.