Changing mappings
A content transfer assumes that your destination Content Manager contains the same structure as your source Content Manager and writes this implicit mapping to the mapping table in mappings.xml. Change these mappings to rename or move content during transfer.
Methods for changing mappings
- One-time mapping
-
To change the mappings table for a specific import, open the mappings table during import, edit the contents of the mappings file, and commit your changes. The import now uses the mappings you changed, but does not save your custom mappings.
- Saved mapping
-
To save your custom mappings and reapply them for an import, do not only commit your mappings changes, but also save your custom mappings to a local file using Save As. To reapply your custom mappings, in the import wizard, open the mappings file and copy-paste the contents of your locally saved custom mappings file over the mappings file content, then commit your changes.
Business rules for changing mappings
Changing mappings is a powerful feature that you must use with caution. Make sure that you use mapping only to rename and/or move items. To make sure that items are mapped correctly, adhere to a number of rules. If you do not respect these rules, an error will be raised, either before or during import.
- Do not change the export part of the mapping, only the import part.
- Do not delete mappings from the table, or create new ones.
- Do not attempt to move the following items using mapping:
- Publications
- Approval Statuses
- Groups
- Multimedia Types
You can, however, rename all of these items.
- Only map to import locations that you know exist on the destination instance.
- Only map to an import item that has the same type and subtype as the exported item. You cannot map, for example, a Folder to a Structure Group, or a Multimedia Schema to a Metadata Schema.
- Do not perform two interdependent mappings at the same time. For example, do not attempt to make a parent and a child folder switch places, or to give two items each other's names.
- If your mapping moves items from one Publication to another Publication, you must add a mapping for the Publication itself (for example, change the title of the source Publication to a target one) and, if necessary, add additional mappings to adjust the locations and/or titles of any dependencies in the Publication of the item you are mapping. Failure to map the Publication leads to an error during import.
Reasons to change mappings
If, for example, a user renamed an item after transfer or you want to move an item to another location, you would need to change the implicit mappings that Content Porter creates during a transfer.
- Scenario 1: A user renamed an item after transfer
-
After Content Porter has transferred a piece of content, Content Manager users on the source system or on the destination system are free to change its name.
For example, say you transfer a Component called OldName from your source system to your destination system, after which a user changes the name to NewName on the destination system. If you now transfer OldName again, Content Porter will not see an item with that name on the destination system, and create it. This results in two items, OldName and NewName, on the destination system.
To prevent this from happening, open the mappings file and explicitly map the OldName item to NewName. You now make Content Porter aware of the fact that the item was renamed, and during transfer, Content Porter renames OldName to NewName and, as a result, updates the NewName item on the destination system.
Use the same approach if after a transfer, someone renames the item on the source system. In this scenario, the source system has an item NewName which you must map to the unchanged OldName on the destination system.
- Scenario 2: You want to move an item to another location
-
Sometimes, the organization of your source system is different from the organization of your destination system.
For example, say you have created an instance of Content Manager that you want to use as an archive of your Web site. Every month, you transfer your Web site to this instance. On the destination instance, you create a new Folder and Structure Group for each month:
Now depending on the month, you would want a Component located in Building Blocks\Folder1 on the source system to be moved to Building Blocks\September 2011\Folder1 on the destination system. You can accomplish this by explicitly mapping to that destination location in your mappings file. Note that the destination location must already be present on the destination system.
Structure of the mappings.xml file
In the mappings.xml file, the mapping table is contained within an XML element called tcccp:Mappings. The mapping table is divided into Item Sets, that is, groups of mappings of the same item types. For example, there are item sets for Folders, for Schemas and for Components. Items sets are XML elements named tcccp:Itemset. The type of items that Content Porter maps is in the role attribute.
Within the item set are one or more mappings, contained in elements called tcccp:Mapping. Each mapping has the following attributes:
ExportContext: the location of the item on the source instanceExportTitle: the name of the item on the source instanceImportContext: the location of the item on the destination instanceImportTitle: the name of the item on the destination instance
By default, ImportContext and ImportTitle are empty. This means that Content Porter attempts to map the export item to the same location on the destination instance without changing the item's name.
You can now do two things:
- To change the location of an item on the destination system, change the
ImportContextattribute. - To change the name of an item on the destination system, change the
ImportTitleattribute.
Sample mappings.xml file
<Mappings xmlns="http://www.sdltridion.com/ContentManager/ImportExport/Package/2013">
<ItemSet role="Publication">
<Mapping exportTitle="Publication" importTitle="" />
</ItemSet>
<ItemSet role="Folder">
<Mapping exportContext="/Publication/Building%20Blocks" exportTitle="Default%20Templates" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="StructureGroup">
<Mapping exportContext="/Publication" exportTitle="Home" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="Schema">
<Mapping exportContext="/Publication/Building%20Blocks" exportTitle="Articles.xsd" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="Component">
<Mapping exportContext="/Publication/Building%20Blocks" exportTitle="Article1.xml" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="ComponentTemplate">
<Mapping exportContext="/Publication/Building%20Blocks/Default%20Templates" exportTitle="Default%20Component%20Template.tctcmp" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="Page">
<Mapping exportContext="/Publication/Home" exportTitle="LandingPage.tpg" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="PageTemplate">
<Mapping exportContext="/Publication/Building%20Blocks/Default%20Templates" exportTitle="Default%20Page%20Template.tptcmp" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="TargetGroup">
<Mapping exportContext="/Publication/Building%20Blocks" exportTitle="Target%20Group.ttg" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="Category">
<Mapping exportContext="/Publication" exportTitle="News%20Category" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="Keyword">
<Mapping exportContext="/Publication/News%20Category" exportTitle="Entertainment.tkw" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="TemplateBuildingBlock">
<Mapping exportContext="/Publication/Building%20Blocks/Default%20Templates" exportTitle="Activate%20Tracking.tbbcs" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="VirtualFolder">
<Mapping exportContext="/Publication/Building%20Blocks" exportTitle="Bundle" importContext="" importTitle="" />
</ItemSet>
<ItemSet role="MultimediaType">
<Mapping exportTitle="Gif%20image.tmt" importTitle="" />
</ItemSet>
<ItemSet role="Group">
<Mapping exportTitle="Editor.tgp" importTitle="" />
</ItemSet>
<ItemSet role="ApprovalStatus">
<Mapping exportTitle="Default_Draft.tas" importTitle="" />
</ItemSet>
<ItemSet role="ProcessDefinition">
<Mapping exportContext="/Publication" exportTitle="Task%20Process.tpd" importContext="" importTitle="" />
</ItemSet>
</Mappings>