New Export Content feature in Mura 6.2
March 31, 2015 by Michael Evangelista
Mura 6.2 provides a robust update to the Mura CMS platform, with a number of bug fixes, security enhancements and new features, as well as notable improvements to some existing features. (See the Mura CMS 6.2 release announcement for an overview.)
In this article we will explore one of the most versatile new additions to Mura's feature set, transferring content from one Mura site to another using the new "Export Content" and "Import Content" options in the Mura CMS site manager.
While Mura's Site Bundles feature allows for the duplication and export of entire Mura sites, the new Export/Import Content feature set allows for much more granular control, exporting a single page or entire sections of the Mura content structure with just a few easy steps. We'll take a look at these options, and explore a few example scenarios using these features.
A New Way to Transfer Content
Any page or section of the Mura content structure can be downloaded as a .zip file (which Mura automatically creates, much like a Site Bundle), and then uploaded or "imported" to duplicate the content in a new location. A single content item and/or the item's child content may be selected, allowing for a variety of export and import scenarios.
Mura 6.2 introduced the Export and Import options as new additions to the "Actions" menu when editing any content item via the Mura Site Manager, making it easier than ever to duplicate content within a Mura CMS site or copy part of a site to any other Mura site running version 6.2 or higher.
Export Any Part of the Site
This global feature applies to all content items within the Mura CMS Site Manager. Select a bottom level element with no children to export only that item, or select any parent item to export its children, with or without the parent included.
The exported content includes images and all standard text, titles and other attributes as seen in the Site Manager. In addition, any custom Class Extensions and related Extended Attribute Set definitions are also exported, along with the values of the extended attributes. (Unlike the Mura Site Bundle feature, the content export does not include any rendering templates.)
To prevent any conflict with previous or future exports, the downloaded zip file is specifically named with the content path, the site id, and a timestamp.
See It In Action
The functionality of the Export Content feature is the same regardless of content type. To demonstrate the robust abilities of the export option, we will copy a complete photo gallery from one site to another, complete with images and all standard and extended attributes.
This site contains a standard Mura photo gallery with lightbox display, based on a section of the site with the default "Gallery" content type, and nested standard "Gallery Item" images.
Note the location of the Gallery content item within the content structure, nested below the "Features" parent folder. This is another flexible aspect of the Export and Import Content options, as the imported page or section does not have to be at the same level of the content structure when imported into the new location.
To export the selected content as a .zip file, we'll use the option under the "Actions" menu. Since the site we're copying the content to does not have an existing photo gallery, we will include the parent Gallery content item, selecting to export "This Content Item and Children".
In this case, we have included the parent item so that the entire Gallery section can be added to another site including the top level gallery thumbnail view. In other instances, the parent item may not be desired, such as when adding news articles, blog posts, or other child content items from one site to an existing section of another. To demonstrate this, we will export the contents of the Blog section from one site into an existing Blog on another.
Here we have selected to export only the children of the "Blog" content section. This will result in the pages under the Blog folder being placed directly under the selected import location.
The downloaded zip file contains a specific internal structure which is written and read by Mura during the Export and Import routines. While it is not recommended to alter or edit anything within this file, we'll take a brief look at the contents for informational purposes.
Within the zip file are a number of .xml documents in "wddx" format. This is a machine-readable xml syntax which stores all of the relevant data used to import the content into specific locations within the Mura CMS database. There are also two .zip files contained within the exported file. The first, assetfiles.zip, contains any assets used within the CKeditor content editor, such as images placed within the Body content of a Mura page. The second .zip file, cachefiles.zip, contains any files or images from Mura's cache directory, such as the Associated Image for a Mura page, or files uploaded as attachments to a "File" type content item. (If either of these folders is empty, the .zip will be created with a placeholder .txt file inside.)
There is no need to open or alter the contents of this file. If changes to the exported content are desired, the recommended workflow includes importing the file to the new location and using the Mura Site Manager interface to make the required changes.
Ready to Import
Selecting the "Export" option from the Actions menu, as shown above, will cause the browser to download the exported content in .zip format. Once this download has completed and the .zip file is saved in a readily accessible location, importing the content into a new site, or into another location in the same site, requires only a few more quick steps. We'll take an in-depth look at that process in our next article.
More About this Feature
Also see Mura CMS v6 Documentation: Export Content. Further documentation for Mura CMS developers and content managers is available at docs.getmura.com . Learn more about Mura's powerful features and flexible options at www.getmura.com.