Articles in this section

stripQuerystring helper

The stripQuerystring helper removes everything from the ? onward in a URL, returning only the base path. Use it when you need a clean URL without query parameters or trailing fragments.

Syntax

{{stripQuerystring url}}

url -- The URL or path string to process. Required.

Examples

Remove query parameters from a URL

{{stripQuerystring record.fullUrl}}

Input:

{ "record": { "fullUrl": "https://example.com/product?ref=ads&utm_source=google" } }

Output: https://example.com/product

Remove query parameters and a fragment

{{stripQuerystring record.fullUrl}}

Input:

{ "record": { "fullUrl": "https://site.com/page?x=1#section" } }

Output: https://site.com/page

Everything from ? onward is removed, including any fragment (#section) that follows the query string.

Strip a query string from a file path

{{stripQuerystring "/local/path/file.html?version=1.0"}}

Output: /local/path/file.html

The helper works on any string -- not just full URLs.

Usage notes

  • Everything from the first ? to the end of the string is removed, including any trailing fragments.
  • If the URL has no ?, it is returned unchanged. A fragment (#) without a preceding ? is not removed.
  • No URL validation or decoding is performed. The helper truncates the string at the first ?.
  • To also remove the protocol prefix, combine with the stripProtocol helper.