Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:09:02+00:00 2026-05-30T01:09:02+00:00

Publishing a component which has multiple dynamic templates will usually result in all the

  • 0

Publishing a component which has multiple dynamic templates will usually result in all the possible dynamic component presentations being published to the broker.

When you create a DCT with the option to place the item on a page, a content editor may not want to publish the components directly, simply relying on the Page publish to do the right thing. We could consider three possible desired publishing scenarios:

  1. That publishing the page should only cause the static component presentations to be rendered, (plus whatever CD code is necessary to display the dynamic ones)
  2. That in addition to static CPs, any dynamic CPs should be published. Other possible dynamic renderings of the same component are not published.
  3. If a dynamic CP is published, the usual component publishing semantics are followed,
    and all dynamic renderings will go to the broker.

Tridion’s default behaviour appears to be scenario 2), whereas my experience is that often what you want is scenario 3), giving you a complete and
consistent view of any given component on the CD side.

What is the best way to implement scenario 3 (including getting unpublish to work correctly)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:09:03+00:00Added an answer on May 30, 2026 at 1:09 am

    In my opinion, the best answer for your question is to implement a custom Resolver that would include the required Dynamic Component Presentations. I would be wary of doing anything when unpublishing, as sometimes you may want to keep the DCPs after unpublishing a given page (for “latest news” type of functionality or any other sort of dynamic queries), but the code sample below would make it simple for you to adapt if you need to unpublish all DCPs.

    Warning: Below code is not production-tested.

    using Tridion.ContentManager;
    using Tridion.ContentManager.CommunicationManagement;
    using Tridion.ContentManager.ContentManagement;
    using Tridion.ContentManager.Publishing;
    using Tridion.ContentManager.Publishing.Resolving;
    
    public class IncludeDynamicComponentPresentations : IResolver
    {
        public void Resolve(
                IdentifiableObject item, 
                ResolveInstruction instruction,
                PublishContext context, 
                Tridion.Collections.ISet<ResolvedItem> resolvedItems)
        {
    
            if (!(instruction.Purpose == ResolvePurpose.Publish ||
                instruction.Purpose == ResolvePurpose.RePublish))
            {
                // Do nothing more when unpublishing
                return;
            }
    
            Session session = item.Session;
            foreach (ResolvedItem resolvedItem in resolvedItems)
            {
                // Only do something if we're dealing with a page
                if (!(resolvedItem.Item is Page)) continue;
                Page page = (Page)resolvedItem.Item;
                if (page.ComponentPresentations.Count > 0)
                {
                    UsingItemsFilter filter = new UsingItemsFilter(session);
                    filter.InRepository = page.ContextRepository;
                    filter.ItemTypes = new[] { ItemType.ComponentTemplate };
    
                    foreach (ComponentPresentation cp in page.ComponentPresentations)
                    {
                        // Find all component templates linked to this component's schema
                        Schema schema = cp.Component.Schema;
                        foreach (ComponentTemplate ct in schema.GetUsingItems(filter))
                        {
                            if (!ct.Id.Equals(cp.ComponentTemplate.Id))
                            {
                                if (ct.IsRepositoryPublishable)
                                {
                                    resolvedItems.Add(new ResolvedItem(cp.Component, ct));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    

    You would now need to add this to the GAC and modify [Tridion]\Config\Tridion.ContentManager.Config so this Resolver is called after every resolve action (under resolving/mappings for every item type).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm publishing an app on the Android Market which has an ad in it.
I am currently working on a specification for a software component which will synchronize
We are handling PDF publishing by using a Dynamic Component Template associated with the
When publishing my web application and then running it will return the error Could
I will be publishing an App in a few days. Initially I don't want
I imagined that publishing a game to xbox live would make it available all
Thank you in advance for any help. I have a website which has OpenGraph
After publishing my XBAP application, I am missing all (or some) TextBlocks. It looks
I have been publishing my MVC3 project to IIS including All Project Files, this
All we get when publishing our ASP.Net MVC 3 app is this: You may

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.