Articles in this section

stripProtocol helper

Removes the protocol (http://, https://, etc.) from a URL, returning a protocol-relative path.

Usage

{{stripProtocol url}}
  • url (required): input URL string

Examples

  1. Remove protocol from a CDN URL

    {{stripProtocol record.cdn}}
    

    Input:

    {
      "record": {
        "cdn": "http://foo.bar/image.png"
      }
    }
    

    Output:

    //foo.bar/image.png
    

Tip

  • Useful for ensuring links work correctly across environments where protocol may vary.

  • The helper preserves the rest of the URL, including domain, path, and query parameters.

  • Combine with stripQuerystring if you also want to remove query parameters while keeping the domain and path.

  • Values that are already protocol-relative (//example.com/...) remain unchanged (no duplicate forwardslashes).

  • Only the first occurrence of <scheme>:// is removed. For example, https://example.com/redirect?url=http://other.com, only the leading https is removed; the http:// inside the query remains.

  • Scheme matching is case-insensitive and can handle HTTP(S). FTP, WS, and h2://.