Unpublishing child items in Sitecore

There are scenarios where we want to unpublish all the child items in Sitecore, and need to publish only few from specific folder/item, this is also required because as a content author we don’t want to delete the items from content tree permanently, but just want to remove it’s reference from web DB, such that when required item can be made available for publishing.

Some examples includes:

  1. Video Repository like Brightcove
  2. Product Repository in Sitecore, whose source is some third party CRM systems.
  3. Employee Repository

Client is not 100% done with all the content authoring, and haven’t reviewed all the content as well, in this case it makes most sense to unpublish all the items, and publish only which is verified by the business and content team, so that only tested content and pages can be made public.

Instead of going to each content item and unpublish one by one, there is an easy to unpublish all the child items at once.
Please follow the below steps to unpublish all child items:

  1. Go to the item in Sitecore for which all child items need to be unpublished.unpublishparentitem
  2. Before we make any updates, please try to browse any child item and make sure that you can browse the page, once this is tested we can move to next step.
  3. Now, go to “Publish”->”Change” option.
  4. From there select “ITEM” tab and uncheck “Publishable” checkbox.
  5. This makes all the child items unpublished.unpublishable
  6. Now publish your parent item,and all child items under it.
  7. Try to load the same child page, and your page status should be 404 now.
  8. Next, go to the parent folder/item again and publish only that item.
  9. Now, go to individual child item(s) and publish only those which are required.
  10. Try to load the page, and this time it should load it as expected.

This way we can keep all content items in Sitecore tree, but doesn’t promote it to web database.

As child items inherit the publish status of the parent item, setting the “Publishable” checkbox to false make sure that items are removed from web.

I hope this will help someone, who is trying to remove all the child item(s), but at the same time, also don’t want to delete items permanently.

Happy learning 🙂

Resolving issue with page preview in Sitecore multisite configuration

With Sitecore multisite solution and architecture, we see site resolving logic might seem to work in unexpected ways sometime,and i encountered this issue couple of weeks back, here are few things to consider with Sitecore multisite configuration.

Let’s assume we have two sites in the same Sitecore instance, this is how the typical structure looks like:

pagepreview

In order to have two sites in the same Sitecore instance, we also need to add site node settings which is present as part of Sitecore.config now,this is how it looks:

<site name=”website” enableTracking=”true” virtualFolder=”/” physicalFolder=”/” rootPath=”/sitecore/content” startItem=”/home” database=”web” domain=”extranet” allowDebug=”true” cacheHtml=”true” htmlCacheSize=”50MB” registryCacheSize=”0″ viewStateCacheSize=”0″ xslCacheSize=”25MB” filteredItemsCacheSize=”10MB” enablePreview=”true” enableWebEdit=”true” enableDebugger=”true” disableClientData=”false” cacheRenderingParameters=”true” renderingParametersCacheSize=”10MB” />

<site name=”my-new-site”…../>

<site name=”website”….> is the default setting that comes with Sitecore, we need to add any new site added to system here, so that site can be resolved, in this example we added “my-new-site” to the list.

It is recommended to keep the Rendering.SiteResolving setting value at “true” for any multisite solution in order to ensure that cross-site links are built with the correct parameters.
Here, the Experience Editor and Preview mode are opened in the context of the site defined in the Preview.DefaultSite setting.

In my case, I observed the page preview mode was throwing error, and when i looked into the “Preview.Default” setting in Sitecore.config file, it was pointing to “website
We had “website” site node , but the location was no longer exists- it was pointing to /sitecore/content/home and we didn’t had any item in this location.

So, there are two options here to resolve this issue:

  1. Update the “website” site node start item in Sitecore.config to point to active site/ location or
  2. Update “Preview.DefaultSite” mode settings with an active site.

Note: Please make any updates to Sitecore.config using Sitecore patch file, so that we don’t mess up anything with the default configurations, and down the line didn’t face any issue with Sitecore upgrade as well.

Also, to make sure that items are opened in context of correct site, we must set the Rendering.SiteResolvingMatchCurrentSite setting to “true”

All configs related to site resolving can be found (“/App_Config/Sitecore.config” in Sitecore 8.x and web.config in 7.x)

Please read more about the site resolving here- https://kb.sitecore.net/articles/986056

Happy learning 🙂

Sitecore | Shared vs Final layouts

One of the new features of Sitecore 8 is the introduction of versioned layouts.

Language Version Layouts give content editors the ability to create different layout definitions for each language version for an item. In Sitecore 8 there is now a Shared Layout and a Final Layout tab in the presentation details dialogue of an item. This is where the magic for the versioning is configured.

The Shared Layout section stores the renderings that are shared across all language versions of an item, while the Final Layout section, stores the renderings that are specific to the current language version you are editing. The Final Layout details panel displays the final combination of presentation details, and determines what is rendered when viewing the current version of the item.

imagelayout

This new feature allows Sitecore users to design and market pages based on different languages. Content editors can now not only update the datasource on a component based on personalization rules, but can also present a different layout structure, including or removing components per language version.

This gives the content editor and marketing team a wider range of variations. If a multi-language site has a different marketing plan or promotional offers based on the language, marketers are no longer restricted to rendering the same components for all languages. The language version layouts open many doors for a customized user experience.

There are however some things that Sitecore users need to remember about this new tool. Currently there isn’t a way to update the shared layouts field from the Experience Editor.

***********************************************************************

Question : What layout do you modify when you edit a page in Experience Editor?

Answer: Final Layout

Before Sitecore 8 regardless of item or language version, it used to update the shared layout,as there was no final layout present.when we open a page item we basically create a delta against page template, and will be presented with the page layout with the delta merged which gets updated to _Renderings field.

From Sitecore 8, we still create delta of what we have in the page template, but the page layout will be presented and updated to _Final Renderings field, which is versioned per language.

Please share your feedback and comments, as how we can make this a great learning platform, much appreciated.

Happy learning 🙂