is it possible to configure an auto publish for these scenarios:

  • specific sections of the content tree
  • item template
  • specific items
  • auto publish using the publishing restrictions values configured(from and to)

I know we can use publish restrictions but as far as I know it doesn't perform an autopublish itself but configures what the timing you can publish an item(from and to) I've ran across some examples where we can configure a publish agent to run on a specific interval. that's fine but this will perform an publish on the whole database. What I'm looking for is ways to publish specifics(like described on the list above), specially configure an auto publish based on the publishing restrictions configured for the item versions.


As Sitecore Climber mentioned, you could use workflows if you do not need to have a future publish date. Otherwise the Automated Publsiher module might help you, but if you really want something specifically tailored to your needs, it should not be that hard to write that yourself. You could add an agent or use other possible solutions to trigger tasks.

There is a blog post here describing on how to extend the existing publish agent with extra parameters e.g. a root item path (as you requested). The trick is actually to look at the implementation and extend where needed.

To give you an idea to build on, if you would like to publish only items from a template you would need to do something like this (untested):

Add a property to pass the template

private readonly string _template;
public string Template
     return this._template;

You would pass the template in the config like <param desc="template">...</param>.

Add parameter to constructor

public CustomPublishAgent(string sourceDatabase, string targetDatabase, string mode, string languages, string template)
   this._template = template;

Write a startPublish function to be used in the run method

private void StartPublish(IEnumerable<language> languages)
  var items = .. // get the items you need based on _template (and other stuff) - preferably use the master index
  var options = new PublishOptions(database1, database2, PublishMode.SingleItem, languages.FirstOrDefault<language>(), DateTime.Now)
  foreach (var item in items)
    options.RootItem = item;
    Publisher publisher = new Publisher(options, languages);

You should be aware that this will start a publish job for each item that is found with you search query. If you want to publish based on several conditions, that will be hard to avoid. But don't do this for too many items at once...

End by adding your custom agent in a config patch:

  <agent type="YourNameSpace.CustomPublishAgent, YourAssembly" method="Run" interval="12:00:00">
    <param desc="source database">master</param>
    <param desc="target database">web</param>
    <param desc="mode (full or incremental)">smart</param>
    <param desc="languages">en</param>
    <param desc="template">..</param>
  • 1
    Can you provide information to answer the question here, rather than link to it so this does not become a link only answer
    – Richard Seal
    Nov 1 '16 at 14:07
  • 1
    Done - although not a full working example it could be a start
    – Gatogordo
    Nov 1 '16 at 14:41

Yes you can configure using workflows. You can set workflows for your items and on final step you can add a command for autopublishing.

You can also use this module : https://marketplace.sitecore.net/en/Modules/Automated_Publisher.aspx

The Automated Publisher module is a module that will automatically generate a Sitecore task to publish an item after its scheduled publication date.

Any time an item is saved (programatically or manually), the Automated Publisher will look to see if the item has a future publication date and set up the task accordingly. This alleviates the need for a manual publish or the use of blanket publishing tasks on a regular basis. Please note that this utility does not bypass workflow and an item that is not in a finalized state of workflow will not be marked as publishable by Sitecore. Please see the documentation link below for technical details (a single modification to the web.config is required to run the Automated Publisher).


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.