How can I customise my media items import into Sitecore?
All files from the attachment field types mapped to corresponding fields in Sitecore are imported into the Sitecore Media Library. The default location for all such items is /sitecore/media library/Gather Content/. Under the GatherContent media folder, all items are structured in the following way ///. If a mapped field has a specified data source, all files will be imported to that location.
The plugin architecture is extensible and the logic of uploading items can be overridden. A new class should be created that inherits the IMediaRepository interface:
public interface IMediaRepository<T>: IRepository where T: class
T UploadFile(string targetPath, File fileInfo);
string ResolveMediaPath(CmsItem item, T createdItem, CmsField field);
ResolveMediaPath method should implement logic on resolving media path. Media path can be a path to media folder in Sitecore or to any other storage (drive, could service etc.)
UploadFile method defines how the importing file will be uploaded to that storage.
After the new class is developed, it should be registered in the Dependency Injection configuration file, which is
Find MediaRepository component and replace current type to newly created on:
type="<namespace>.<new class name>, <assembly name>">
How does the integration support multiple languages?
It's possible to import content from GatherContent in multiple languages in Sitecore. GatherContent most commonly supports multiple languages via separate tabs within an item as shown below.
Setting up the template mappings
In order to import all language versions into a single item in Sitecore, a mapping should be specified for each language version (so for each separate tab).
Follow the steps to set up your tab template mapping as described in Step 2: Template Mappings.
Importing the content
1. Navigate to the item (node) in the Sitecore tree that the new items should be imported to, and click 'Import' in the top bar
2. Select the GatherContent project to import your content from
An import content dialog will appear showing an empty grid. At this stage, you can select any GatherContent project with a mapped template. You can also filter items by GatherContent workflow status and Template.
3. Select the items you want to migrate
Select the items you'd like to import using the checkboxes and then click the 'Next' button. This will launch the confirmation screen.
4. Specify the language, destination and select the items' status
On the confirmation screen, it's possible to specify which language in Sitecore all items will be imported to and which mappings to use.
For example, to import English content from GatherContent into the English version in Sitecore, set 'English' as the Language.
5. Start the import
Clicking the 'Import' button will start the import process. The process can take some time depending on the number of items being imported.
6. Once the import is complete, repeat this process for each language version (each tab)
As soon as content from one language version has been imported, the next version can be imported in the same destination folder but with different configurations.
7. View the results
As a result, we will get multilingual items in Sitecore.
How does the integration support importing metadata?
If there is any metadata attached to an item in GatherContent, it can be imported to Sitecore as well. This process is the same as the method for importing from different tabs (shown directly above).
1. Add metadata fields
You should add metadata fields to your GatherContent Templates Just like any other fields that you want to be mapped and copied during the import process.
2. Map fields
If the metadata content is independent of a specific language within a multilingual project, it should be mapped only once in any language-specific mapping. Otherwise, metadata fields should be mapped for every language independently as any other content.
How do I convert internal GatherContent item links into Sitecore links?
You can convert your GatherContent item links into Sitecore links using our integration.
All hyperlinks within rich text content pointing to internal content items in GatherContent can be converted (expanded) into Sitecore links during or after your import. In order for the integration to convert your GatherContent links, your URLs must always be in the following format (the format of an item link):
Links can be expanded either during the import process by checking "Expand GatherContent Links" checkbox:
Or after the import by selecting a content node pressing Expand Links button on the GatherContent ribbon.
In both cases, the system will scan all rich text fields within the selected sub-tree and convert GatherContent links to corresponding Sitecore links. The system will be able to convert a link if the referring item has been imported to Sitecore as well and that item has a Presentation layer.
How long does the import take?
This depends on the number of items you’ve selected for import. The number and size of attachments will also impact the import time.
Does the integration support import to a date field?
It is possible to store a date in a regular text field within GatherContent and import that into Sitecore in date format (Date or DateTime field types).