Get current page template name or path in a custom global module

I have created a custom global module. It is going to be placed on multiple templates, drag and drop page templates not coded templates. However, I need to do some conditional logic to show/hide based on what page template it’s used on.
All the content in the global module will be the same with the exception of an image. I need to use a specific image on one template but a different one on another. This module is actually pretty complex and has a lot of content. So cloning it for different templates just to set a different image is not preferred because all the other content would have to be re-entered or would have to update each module separately when updating the content.
So basically what I want to do is create two image fields and then display one or the other depending on what template the module is placed on. But I can’t seem to find anything in the docs, which is weird because I feel like this is something many devs would utilize. I’m normally a Wordpress dev and doing something like this is super simple.

I was hoping there was some content variable or a way to do something like this. I realize these variables don’t exist, I’m just showing what I hope there was something similar to.

{% if content.page_template_path == '/path/to/draganddroptemplate/template-name' %}

OR

{% if content.template_name == 'template-name' %}

I know there is content.template_path but when I put that in my custom module, it returns the path of the generated html file for the module itself, not the drag and drop template that is being used for the page it’s on.
Any suggestions or help would be greatly appreciated.

Hello @KiwiCreative , actually {{template_meta.label}},{{template_meta.path}} and{{template_meta.display_name}} will give you the template file name, the template path and the template label respectively.
You can access the whole dict that contains information about the current page by clicking on the sprocket menu in the upper right corner of the window and selecting “Developer Info” like shown in the screenshot below.

If my answer was helpful please mark it as a solution.

@miljkovicmisa Thank you so much!!! You’re a life saver! That was exactly what I was hoping to find. I really appreciate the help.

Hi @KiwiCreative ,
Use Bottom code in table hide globle header and use another header for new page.
{% block header %}
{% global_partial path=‘./partials/header-no-navigation.html’ %}
{% endblock header %}

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.