Using Sitecore 8.2.current we're seeing la=en
added to a number of our media library (unversioned) image usages (<img src="_.jpg?la=en" />
).
In Sitecore version 7.something (7.2?) the recommendation was to override GetMediaUrl
to work around Sitecore not having configuration options to cover this.
Is that still the best practice in Sitecore 8.x, or can we make a configuration change to workaround this?
In the master database we only have en in /sitecore/system/Languages.
Verifying with /sitecore/admin/showconfig.aspx, on linkManager
we have <add name="sitecore" languageLocation="filePath" languageEmbedding="never" />
(only relevant attributes shown).
In case it mattered, I also added language="en"
to the relevant <site>
declaration, to no avail.
Thanks!
Update 1:
Thanks to some assistance in the comments, if we use Sitecore.Resources.Media.MediaManager.GetMediaUrl(imageField.MediaItem, mediaUrlOptions);
and set mediaUrlOptions
to new Sitecore.Resources.Media.MediaUrlOptions()
or Sitecore.Resources.Media.MediaUrlOptions.Empty
la=en
is not added
If we use Sitecore.Links.LinkManager.ExpandDynamicLinks()
with a Rich Text field type image sources are expanded, but include the language parameter.
languageEmbedding="never"
, the language still shows up in the image link?GetMediaUrl()
method? Are you passing theMediaUrlOptions
as parameter?Sitecore.Links.LinkManager.ExpandDynamicLinks()
when pulling Rich Text content fields or passingnew Sitecore.Resources.Media.MediaUrlOptions()
. Both are resulting in language being included.MediaUrlOption()
as empty, it should not append the language. Example:` GetMediaUrl(item, MediaUrlOptions.Empty);`