How to add default URL in Sections Schema

Topic summary

Core Issue:
When creating a Shopify section schema with a URL input type, attempting to set a default URL (e.g., “/collections/mycollection”) triggers an error: “Invalid schema: default with id=‘link’ must be a string or datasource access path.”

Root Cause:
Shopify’s URL input type only accepts two predefined default values:

  • /collections
  • /collections/all

These are the only URLs Shopify recognizes as existing by default in every store (collection list page and all products page).

Community Reaction:
Multiple users consider this a “ridiculous restriction” and “wild limitation,” noting that Shopify allows any string as a URL in the admin interface, so restricting defaults seems unnecessary.

Workaround Solution:
Use conditional Liquid logic to check if the URL field is null and output a fallback default:

{% if section.settings.button_link != null %}
  {{ section.settings.button_text }}
{% else %}
  {{ section.settings.button_text }}
  (https://www.yourdefaultlink.com)
{% endif %}

Status: No official solution exists; workaround remains the only option for custom default URLs.

Summarized with AI on November 4. AI used: claude-sonnet-4-5-20250929.

I have been trying to create a schema for a dynamic section, and use some predefined default URL for some pages but liquid cannot accept it. This is the schema code:

{% schema %}
{
  "name": "My New Section",
  "class": "homepage-section",
  "tag": "section",
  "settings": [
    {
      "type": "text",
      "id": "section-heading",
      "label": "Section Heading",
      "default": "Default Heading",
      "info": "Meaningful copy in 25 characters or less."
    },
    {
      "type": "url",
      "id": "link-1",
      "label": "Link URL 1",
      "default": "/collections/mycollection"
    }
  ],
  "presets": [
    {
      "name": "My New Section",
      "category": "My Sections"
    }
  ]
}
{% endschema %}

So, for the “type”: “url” I try to define the default collection “default”: “collections/mycollection” and this is the error message when I try to save the file:

This file contains the following errors:

  • Error: Invalid schema: setting with id=“link” default must be a string or datasource access path

I tried some different options without success:
“default”: “https://testing.myshopify.com/”
“default”: “https://testing.myshopify.com/”
“default”: “collections/mycollection”
“default”: “collections/mycollection”

Please, let me know if there is anyway to handle it.

Per reply I got from Stack Overflow:

You need to read the documentation regarding the special input type provided by Shopify called URL

According to the documentation, you can only set these 2 URLs by default:

  1. /collections
  2. /collections/all

This is because these are two URLs that are present after the store creates automatically, one is set for all collections list pages and once for all products pages. so Shopify knows these two’s have already existed.

So these are two default values that you accept into URL fields into the Shopify schema.

1 Like

This is a ridiculous restriction, Shopify allows any string as a URL in the admin why would it matter if you link to a page that doesn’t exist.

Can anybody from Shopify address changing that default?

3 Likes

In case you or anyone else who searches for this wants a workaround from the annoying inability to have default URLs in your schema, you can check if the field that contains the URL is null as a way of outputting a default link:

{% if section.settings.button_link != null %}  
  
    {{ section.settings.button_text }}
  
{% else %}
  [
    {{ section.settings.button_text }}
  ](https://www.yourdefaultlink.com)
{% endif %}

Fully support this, a wild limitation. I imagine they are doing this because they want the theme editor to be able to detect the URL/page you’ve set and make it a literal reference like when you pick the page in the editor. BUT couldn’t it just be a flat URL instead of trying to be smart.