When Smartling captures visual context from your Sitecore site, it constructs a URL for each page. You can append custom query string parameters to these URLs using the Smartling.Context.CustomQueryString setting. This is useful for controlling how your site renders during context capture, such as forcing a specific site definition with sc_site.
Why use a patch file
The Smartling.Context.CustomQueryString setting is defined in the connector's own config file (Smartling.Connector.Remote.config). Editing this file directly works, but the change is lost whenever the connector is upgraded, because the installer overwrites the file.
The recommended approach is to use a Sitecore config patch file. Patch files are stored separately from the connector package, so they survive upgrades without any manual re-configuration.
Creating the patch file
In your Sitecore instance, create a subfolder inside
App_Config\Include\. Use your company or project name, for example:App_Config\Include\YourCompanyName\
Sitecore loads subfolders after all root-level Include files, so your patch will always override the connector's default value.
- Create a new file in that folder, for example
Smartling.Context.Custom.config. Paste the following content, replacing
YOUR_VALUE_HEREwith your desired query string:<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/"> <sitecore> <settings> <setting name="Smartling.Context.CustomQueryString" set:value="YOUR_VALUE_HERE" /> </settings> </sitecore> </configuration>For example, to force a specific site definition during context capture:
<setting name="Smartling.Context.CustomQueryString" set:value="sc_site=mysite" />- Save the file. No application restart is required in most Sitecore versions.
Verify the setting took effect by browsing to:
http://[your-host]/sitecore/admin/ShowConfig.aspx
Search for
Smartling.Context.CustomQueryStringand confirm thatpatch:sourcepoints to your new file.
How sc_site interacts with ContextSite
If you use sc_site in your custom query string, be aware of how it interacts with the connector's ContextSite setting:
| ContextSite setting | sc_site in CustomQueryString | Result |
|---|---|---|
| Set | Not present | ContextSite value is used |
| Set | Present | CustomQueryString value wins |
| Empty | Present | CustomQueryString value is used |
| Empty | Not present | sc_site is not included in the URL |
Reserved parameters
The following query string parameters are reserved and cannot be overridden via CustomQueryString:
sc_itemidsc_langsc_versionsl_impr