Header/footer dependent on template

Hi,

We want to apply a certain header and footer in the export for a reconciliation template. We can do this by creating a different style and export the template via this style bundle.

But is it also possible to give conditions to our header/footer so we can export a bundle with different templates where only one (or multiple) template(s) has(/have) that header/footer.

For example we have a style (bundle) called ‘Client bundle’ with template_A, template_B & template_C
We only want template_C to have this specific header & footer. Is there a possibility to export this client bundle with the specific header for template_C in 1 step?
For example by applying the following in our Client bundle style header:

{% if template.handle == template_C %}
....
{% endif %}

Another option is a separate style for template_C, export the template, save as document and use it in the bundle. But of course this an extra step we want to avoid.

Can someone help out here?

Kind regards
Jelle

Hi @JelleBe

The information you can access in a style is very limited.
(for reference: export)

The header cannot access the exact templates that are being printed.
It can however access the title of the “blocks” in your exports.


If you can isolate the template that needs the specific header in one of these export blocks, then it will work with the following code:

{% if export.current_title == "Template C" %}
....
{% endif %}

I hope that makes sense and can be a viable workaround,

kind regards
Romy

Thank you Romy for your response.

It doesn’t seem to work. I’m using it in my footer and header:

I’m using the right bundle (style) in my export.

.

Still it’s not printing my header nor footer in my export for Template C.

Nevertheless it would only be a partial solution as we use different margins & logo (no logo) as well for a client bundle.

I think there is no other choice than exporting this template separately and then save it as a document under ‘Documents’ and then add it to the client bundle.

In any case, thank you for your response.

Kind regards
Jelle

Hi Jelle,

if there’s need for different margins and logo, I think there is indeed no better option at the moment than creating a separate style.

Interesting that the code did not work for you, maybe an contains instead of ==
could do the trick, but sounds like it’s a bit irrelevant anyway.

Kind regards,
Romy

Ok thanks !

Kind regards
Jelle