Hello, I am wondering if I can use conditional if statement logic based on the type of file the partial is being included from.
For example, if both my List and Single layouts ingest partial sidebar, can I have logic in the sidebar partial to display slightly modified information?
Thank you @maiki. I tried that along with the solution in the post, but neither work exactly like what I need. I am using the same img.html partial for both my list item images and my hero images in my single pages.
Adding the .isPage does indeed add lorem ipsum to the single pages, but I also see it on my list page as a part of my summary partial (which consumes the img.html partial).
Sounds like you are close to figuring it out. Now that you know you can figure out if the output is a page, you can step back and see if the partial can be refactored.
I suggest also looking at .Kind:
Possible return values are page, home, section, taxonomy, or taxonomyTerm.