CMS Development

albertsg
Ratgeber/-in

Load/Import HTML file into Template

lösung

Hi guys.

 

I have a question regarding Templates and HubL.

If I'm not using a drag and drop template, is there a way to load an HTML file into the template?

 

Imagine that I need to load a piece of code or another depending on a parameter in the URL. For example:

 

if url contains '/es/' then

    load_html_1

else

    load_html_2

endif

 

Is it possible? If yes, how can I do it with HubL? I cannot find anything in the documentation.

 

And no, I don't want to use custom modules. I'm talking about calling a template from another template. 

 

Thank you!



Did my answer help you? Mark it as a solution


Book time with me

You can also connect with me on LinkedIn



1 Akzeptierte Lösung
albertsg
Lösung
Ratgeber/-in

Load/Import HTML file into Template

lösung

Solved, using partial templates and include them. Easy solution but the documentation is so bad structured that is hard to find what we need. If someone is interested, to include a partial template just do the following:

{% include "Your/URL/to/the_template.html" %}



Did my answer help you? Mark it as a solution


Book time with me

You can also connect with me on LinkedIn



Lösung in ursprünglichem Beitrag anzeigen

3 Antworten
albertsg
Lösung
Ratgeber/-in

Load/Import HTML file into Template

lösung

Solved, using partial templates and include them. Easy solution but the documentation is so bad structured that is hard to find what we need. If someone is interested, to include a partial template just do the following:

{% include "Your/URL/to/the_template.html" %}



Did my answer help you? Mark it as a solution


Book time with me

You can also connect with me on LinkedIn



Kmakri
Mitglied

Load/Import HTML file into Template

lösung

Hi, can you provide the steps for uploading an html code into an existing template please?

Thank you in advance.

0 Upvotes
albertsg
Ratgeber/-in

Load/Import HTML file into Template

lösung

Sorry for the late reply, didn't see your question.

 

I already provided the solution, just create a partial template with your code and add it to the main template using the following:

{% include "Your/URL/to/the_template.html" %}



Did my answer help you? Mark it as a solution


Book time with me

You can also connect with me on LinkedIn



0 Upvotes