I have a product listing page that leverages dynamic pages with custom objects. The query runs a filter to only select products with an in_stock value of TRUE.
My issue is that the products that are not in stock are still getting indexed and are returned in my site search results and appear with “NULL” page titles.
Is there a way to dynamically block the products for pages that are not in stock from being indexed?
I know that I could explicitly block the pages from being indexed in the robots.txt config, but I’d like to make this dynamic since the in stock values will change over time.
The require_head tag will make sure that it is added to the <head> of your page, so you can essentially place that wherever you are checking the stock.