This is related to My other question but I felt it needed to be asked on it's own. As stated above, attempting to fetch data from a collection always fails on the robots.txt.liquid template. Even just trying to fetch the number of products in a collection will not return anything.
Below is some code I was using while trying to figure out what was going on. Any attempt to loop over the products in the target collection will fail when the code is placed in robots.txt.liquid. If I use that code in any other template it will work perfectly.
Anyone know if this is a bug or one of those limitations/restrictions that Shopify can't be bothered to document? Or am I being an idiot and this limitation is listed, but I missed it?
I am trying to automatically add products from a specific collection to the disallow list, as those products have been discontinued. I want them removed from search indexes before I archive the products.