0

I'm wondering if there is a way to publish a page with and the links that refer to it all at once.

What I did was...

  1. Delete the original page
  2. Update all the links to the new page.
  3. Publish out the new page
  4. (PROBLEM) Pages that refer to the new page don't have the updated links. I need to go one by one to each page and publish out those pages separately to update the links

Is there an easier way to update all the links in the link database?

I've tried publishing-related items but this does not publish out related links.

Sitecore 8.2

4
  • Publish the new page with related items checked or do site publish Mar 12 at 20:43
  • @MaheshRaghupathi As mentioned above, I have tried publishing related items. This doesn't publish out links. Publishing out the whole Sitecore tree can be dangerous as well if there is content that shouldn't be published out.
    – scouty
    Mar 15 at 14:40
  • If you use workflow, why is it dangerous to publish entire site? Mar 15 at 19:32
  • @MaheshRaghupathi Workflows arent being used. That is why this is an issue.
    – scouty
    Mar 31 at 14:49
1

I tested in sitecore 9.2 and unfortunately this scenario is not working unless you specifically publish the items referencing the new one aswell. When "Publish related items" is checked the <getItemReferences> pipeline (defined in Sitecore.config) will be executed to get additional items that are then added to the publishing queue.

    <getItemReferences>
      <processor type="Sitecore.Publishing.Pipelines.GetItemReferences.AddItemCloneReferences, Sitecore.Kernel" />
      <processor type="Sitecore.Publishing.Pipelines.GetItemReferences.AddFileDropAreaMediaReferences, Sitecore.Kernel" />
      <processor type="Sitecore.Publishing.Pipelines.GetItemReferences.AddItemLinkReferences, Sitecore.Kernel" />
      <processor type="Sitecore.Publishing.Pipelines.GetItemReferences.AddItemAliasReferences, Sitecore.Kernel" />
      <processor type="Sitecore.Publishing.Pipelines.GetItemReferences.AddItemTemplateReferences, Sitecore.Kernel" />
    </getItemReferences>

If you look at Sitecore.Publishing.Pipelines.GetItemReferences.AddItemLinkReferences it uses item.Links.GetValidLinks() which is implemented in Sitecore.Links.ItemLinks like this (I pasted only the first part of the method):

private ItemLink[] GetLinks(
      ItemLinkState linkState,
      bool allVersions,
      bool includeStandardValuesLinks)
    {
      List<ItemLink> links = new List<ItemLink>();
      Item[] objArray1;
      if (!allVersions)
        objArray1 = new Item[1]{ this.Item };
      else
        objArray1 = this.Item.Versions.GetVersions(true);
      Item[] objArray2 = objArray1;
      using (new SecuritySwitcherSlim(SecurityState.Disabled))
      {
        Dictionary<ID, Field> dictionary1 = new Dictionary<ID, Field>();
        Dictionary<string, Dictionary<ID, Field>> dictionary2 = new Dictionary<string, Dictionary<ID, Field>>();
        foreach (Item obj in objArray2)
        {
          if (obj != null)
          {
            if (includeStandardValuesLinks)
              obj.Fields.ReadAll();
            for (int index = 0; index < obj.Fields.Count; ++index)
            {
              Field field = obj.Fields[index];
              if (field != null)
              {
                  //add links
              

You can see that it doesn't look into the referrers of the item, instead it takes only the items referenced in all the fields. If you want to publish the referrers you will have to implement a custom processor and add it to the section, you could follow the example Sitecore Related Items to publish only Related Media items of an item.

2
  • In 9.2, you can enable deep publish setting Mar 12 at 22:29
  • Except the question is for 8.2 ;), but the answer might still be valid. Mar 14 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.