1

I have a couple of controller renderings where the data loaded is from several Sitecore items including the "page" itself, and the Rendering datasource is not actually set on the Rendering. How can I cache this so that the rendering is cached differently for each page it's on despite no datasource on the rendering being set? I would think Vary By Data, but doesn't that only work if you have different datasources set on the individual renderings?

  • Can you try to add also the vary by param and see if it works? So, check the cacheable, vary by data and vary by param – Hishaam Namooya Sep 5 at 21:36
  • 1
    No rendering should be implemented like this – Mark Cassidy Sep 5 at 23:03
1

As long as the output is always the same on each page then you can use Vary By Data, this will cache based on the context item if no data source is set.

Note that as per Mark's point this might not be the best way to implement a rendering as you will lose the ability to personalize the rendering through the Datasource.

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.