Hint: Not seeing images or media folder in DXA BinaryData Folder

When you are done setting up your DXA within Tridion and can see your DXA Publications and DXA Home Page as below-

Then you proceed with rest of the publications needed for your client.

After creating all publications, when you work around with your Topology manager in CMS (Content Manager Server), You run Add-ttmMapping command on Powershell ISE to map all the new Web Publications (Ex:tcm:0-11-1) so that when you publish the page from this publication, you have the published page on end point (end point is website in Topology Manager) you set.

When you enter this command as below, it asks you to provide below information:

PS C:\Windows\system32> Add-TtmMapping
Id : 
PublicationId : 
WebApplicationId : 

Once this is set when you  do  Get-ttmMapping to list out mapped publications as below:

PS C:\Windows\system32> Get-TtmMapping
CmEnvironmentId : TridionCM_db-example-tridion-devcom
PublicationId : tcm:0-11-1
EnvironmentPurpose : Staging
WebApplicationId : Website2_RootWebApp
RelativeUrl : /us
PrimaryMappedUrl : https://example-tridion-dev.com/us
IsOffline : False
CdEnvironment : 
Id : Mapping3
ExtensionProperties : {}

Here “RelativeUrl” is same as the publication url in Publication properties in CME and that’s how you form your Site Url.

When your Business Process Type is attached to your publication, in your Publication > Properties > Publishing tab you have 2 fields to set:

  1. Web site location: Where you are going to see the published page, ex: http://localhost/
  2. URL path segment: This is nothing but the same “RelativeUrl“.

At this very moment you are ready to publish your page using the new publication you set and see the page on the endpoint you used. in our case it is – http://localhost/

When you see the page on http://localhost/, you see broken images.

When you debug and end up looking at the logs in your presentation server, It just say – Image not found at location: /en/images/

In DXA, the BinaryData folder contents the cached files like images, jsons etc.. and this files are the primary reference to your website. So its wise to look at these files, specially in the json files and confirm that the properties set in the CME is visible.

Now when you check the all.json in BinaryData\en\media\  or BinaryData\en\images\ (whichever you are using), you get your clue for not seeing image or media folder:

{"defaultLocalization":true,"staging":true,"mediaRoot":"/media/",
"siteLocalizations":[{"Id":"11","Path":"/en","Language":"English","IsMaster":
true}],"files":["/en/system/config/core.json","/en/system/config/core.schemas.
json","/en/system/config/core.taxonomies.json"]}

The clue is – “mediaRoot”:”/media/”, value here in is not correct, it should have been “mediaRoot”:”/en/media/”

As said above, DXA populates BinaryData for cashing purpose and all the json you see are the properties published from CME, but these properties in DXA are only published when you publish the “Publish Setting” page under \Home\_System\.

pub-publish-setting-page

So when you publish this page and do /admin/refresh on your url, for example: http://localhost/admin/refresh , It refresh your cache and you see the updated json value in BinaryData as – “mediaRoot”:”/en/media/”, which in turns let’s you find the image locations under BinaryData\en\media\  or BinaryData\en\images\ folder.

Hence you see your site working with your new publication.

That’s it. :)

 If you still need help, Please post your question on Tridion Stack Exchange (Trex)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s