2

I'm configuring an RSS feed in Sitecore, and I'm using a query to select my items. I have a huge number of articles under /sitecore/content/articles/issues organized into folders by year (e.g. /2010, /2011, /2012...) The issue is that the RSS feed needs to include articles from 2019 AND 2020, but NOT from any of the other years. All of the articles are of the same template. Is it possible to use an OR statement in a fast query to choose path a OR path b?

This is my query currently :

query:/sitecore/content/Issues/2020//*[@@templateid='{DF4B07BF-922B-4CC0-9C1E-CFDC3750323C}']

...which obviously only gets articles from 2020, vs this, which gets articles from 2010-2020 :

query:/sitecore/content/Issues//*[@@templateid='{DF4B07BF-922B-4CC0-9C1E-CFDC3750323C}']

Ideally I need a way to do something like this :

query:/sitecore/content/Issues/2019//*[@@templateid='{DF4B07BF-922B-4CC0-9C1E-CFDC3750323C}'] OR /sitecore/content/Issues/2020//*[@@templateid='{DF4B07BF-922B-4CC0-9C1E-CFDC3750323C}']
4
3

query:/{path}/* : Used to get all child items under the specified {path}.

So to get all the child items under 2019 and 2020 folder, we need to use pipe separator("|") to select multiple paths in one expression as follows.

query:/sitecore/content/Issues/2019/*|/sitecore/content/Issues/2020/*

Tested this in my local Sitecore instance. This is working fine.

Reference & Credits :

  1. https://doc.sitecore.com/SdnArchive/Reference/Using%20Sitecore%20Query/Sitecore%20Query%20Syntax.html
  2. http://rajsitecore.blogspot.com/2018/10/an-introduction-with-sitecore-query.html

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.