We would like to understand how Sitecore SXA create a link for CTA link component ? We use CTA link in Sitecore and add link through Internal Link and provide Query string value here. When we check this link in Experience Profile then it is showing query string with ? mark.

Example : https://domain.com?name=value

Need to understand , where are they adding ? in URL in CTA link in Sitecore code.

enter image description here


This is how query strings works. Browser needs to know which part of url is protocol (knows it as url contains // and http or http or ftp before), which part is domain (knows it because of . like .com, .net, ...) and ? is used for query strings so everything which is after this character is considered as query string to pass some parameters towards server.

Query String Definition

A query string is a part of a uniform resource locator (URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML form.

A web server can handle a Hypertext Transfer Protocol (HTTP) request either by reading a file from its file system based on the URL path or by handling the request using logic that is specific to the type of resource. In cases where special logic is invoked, the query string will be available to that logic for use in its processing, along with the path component of the URL.


Typical URL containing a query string is as follows: https://example.com/over/there?name=ferret

When a server receives a request for such a page, it may run a program, passing the query string, which in this case is, name=ferret unchanged, to the program. The question mark is used as a separator, and is not part of the query string.

Web frameworks may provide methods for parsing multiple parameters in the query string, separated by some delimiter. In the example URL below, multiple query parameters are separated by the ampersand, "&": https://example.com/path/to/page?name=ferret&color=purple

Source: https://en.wikipedia.org/wiki/Query_string

  • thank you for sharing the answer. However, I am try to understand where Sitecore creating this URL in code. Need to understand that one. Need some modification in URL and I am not able to find the exact code. I have checked GeneralLinkForm class under Sitecore.XA.Foundation.Multisite.Controls but did not find anything relevant – User7864 May 6 at 8:14
  • @SXAMember Your question should focus on WHAT you are trying to achieve, not HOW you think it should be achieved. – Mark Cassidy May 6 at 8:20
  • This is not SXA functionality but Sitecore OOTB – Peter Procházka May 6 at 9:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.