link Function
Generates a valid relative url to the provided type. The parameters that should be provided vary depending on the link type.
link
resource links
The link
function is compatible with the Link
resource
{{ link(callToActionLink) }}
{% schema %}
{
"callToActionLink": {
"type": "link"
}
}
{% endschema %}
Resource links
For links attached to specific resource IDs.
{{ link({ 'type': 'item', 'id': '3' })}}
{{ link({ 'type': 'category', 'id': '10' })}}
{{ link({ 'type': 'page', 'id': 'square_online_page_id' })}}
{{ link({ 'type': 'custom', 'id': 'square_online_custom_page_id' })}}
System links
For links to pre-defined system level Square Online pages or Square Online theme pages.
{{ link({ 'type': 'shopAll' })}}
// output: `/s/shop`
{{ link({ 'type': 'storiesOverview' })}}
// output: `/s/stories`
{{ link({ 'type': 'orderOnline' })}}
// output: `/s/order`
{{ link({ 'type': 'giftCards' })}}
// output: `/s/gift-cards`
{{ link({ 'type': 'appointments' })}}
// output: `/s/appointments`
{{ link({ 'type': 'storeLocator' })}}
// output: `/s/store-locator`
{{ link({ 'type': 'transactionPolicy' })}}
// output: `/s/transaction-policy`
{{ link({ 'type': 'splash' })}}
// output: `/s/splash`
{{ link({ 'type': 'cart' })}}
// output: `/s/cart`
{{ link({ 'type': 'customerAccounts' })}}
// output: `/s/customer-accounts`
href
links
For standard html links.
{{ link({ 'type': 'external', 'href': 'https://squareup.com' })}}
// output: `https://squareup.com`
{{ link({ 'type': 'email', 'href': 'janedoe@squareup.com' })}}
// output: `mailto: janedoe@squareup.com`
{{ link({ 'type': 'phone', 'href': '123-456-7890' })}}
// output: `tel: 123-456-7890`
{{ link({ 'type': 'file', 'href': '/your/file/link.txt' })}}
// output: `/your/file/link.txt`
{{ link({ 'type': 'anchor', 'href': 'section' })}}
// output: `#section`