Nicely packaged Sitecore Items

Okay, so we all love and appreciate something that has been packaged up nicely. There are some really useful features built into Sitecore package designer that can make a huge difference in the packages we create and even save us time.

04_06_11_themugpub_1

Saving & Opening Existing Packages

If you have spent time creating a package you should save it so that if you need to modify it later, you can. After you have generated and installed the package but discover you have forgotten to include something rather than go through the pain of creating a new package you can simply open the existing package. Opening a package allows you to modify the items contained in the package or add new items. This is a no-brainer.

Define the installation options

How many of us think about the installation options when we create a package? The installation options tab allows you to define the actions the installer will take when it encounters a package item that already exists in the target Sitecore instance. If you don’t define the install options during package creation it will default to Ask User. This will require the person installing the package to decide what action to take each time the package is installed. If you know what this should be ahead of time why not set it during creation.

Overwrite – Items with the same ID (along with any existing children) are replaced by items from the package.

Merge – when you merge you can choose:

  • Clear – All the existing version of the item in the language that you specify are replaced by the new versions.
  • Append – item versions from the package are added on top of the existing versions of the item. This preserves the history but gives a higher number to the new package version than the existing version number. A user can merge information between versions afterward.
  • Merge – if there is a version with the same number in the item, the Installation Wizard will overwrite it, otherwise, a new version with the specific number is added. This makes it possible to replace specific versions of items.

Skip – Items with the same ID from the target installation will remain unchanged; items from the package will be skipped.

Ask User – the default behavior.

Add items dynamically rather than statically

You should use static sources when you want to include all the items that are stored under a specific node in the content tree or if you only want to include a few specific items. But when you have items that cannot be easily selected, for example, if you want to include everything created after a certain date you should add items dynamically.

After you specify the database and root item you are presented with several source filters. These allow you to filter item to be included in your package. The available filters are:

  • Item Name Filter – filter items by name or by a part of
    the name.
  • Creation Date – filter items by the date they were created.
  • Modification Date – filter items by the date they were modified.
  • Publish Date – filter items by the date they were published.
  • Template Filter – Filters items by templates that the items are based on. Only the items which are based on at least one of the templates from the list are added.
  • Created By – filters items by the users who created them and/or by the roles which the users who created the items belong to.
  • Updated By – filters by users who updated an item last and/or by roles which those users belong to.
  • Language – select from available configured languages.

Package items for a specific language

When you add static items to a package it includes all language versions of the item. But what if you only want to include a specific language version of the item to the package. To achieve this you could add Items Dynamically and then filter by the Language selecting the appropriate language.filterlanguages

Reviewing Package Items

Previewing the package will show you the items included in the package and allow you to locate items and even remove items. To remove items simply select the source and click preview, search for the item, once you have located the item right-click on it and select exclude from the popup.Find_and_remove

Manipulating Package Files

When you save a package file it is saved to the following location: Data\packages as a package definition XML file. If you know what you are doing you can easily manipulate this package XML directly without using the package designer. You might find this much quicker than using the designer. Once you’ve finished editing the package file you can simply open it in Package Designer and just generate your package zip file.

Additional Info

 

Happy Packaging!!

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s