Can't visualize my sections!

Hi everyone,

As I am doing the Developer || practicum, I encountered this issue:

I am trying to call the home.html file within the base.html file

but my sections are not being dispalyed.

What is the correct form of retreiving the home content to get properly displayed on my page?
here is the code for base.html as well as home.html

base.html

<!--
 templateType: page
 isAvailableForNewContent: true
-->
<!doctype html>
<html lang="en">
 <head>
 <meta charset="utf-8">
 {% if content.html_title %}<title>{{ content.html_title }}</title>{% endif %}
 <meta name="description" content="{{ content.meta_description }}">
 {{ require_css(get_asset_url('/Practicum/css/main.css')) }}
 {% if brand_settings.primaryFavicon.src %}
 <link rel="shortcut icon" href="{{ brand_settings.primaryFavicon.src }}" />
 {% endif %}
 {{ standard_header_includes }}
 </head>
 <body>

 <div class="body-wrapper {{ builtin_body_classes }}">
 {% block header %}
 {% global_partial path='/Practicum/Templates/partials/header.html' %}
 {% endblock header %}

 <!--Main Content-->
 <main id="main">
 {% block body %}
 {% endblock body %}
 </main>

 {% block footer %}
 {% global_partial path='/Practicum/Templates/partials/footer.html' %}
 {% endblock footer %}
 </div> 

 {{ standard_footer_includes }}
 </body>
</html>

home.html

<!--
 templateType: page
 isAvailableForNewContent: true
 label: Home
-->

{% extends './layouts/base.html' %}

{% block body %}

{% dnd_area 'dnd_area' label= 'Main Content' %}

{# Image and Text section #}

{% include_dnd_partial path= "/Practicum/Section Template/two-columns-section.html"%} 

{# Team members section #}
{% include_dnd_partial path= "/Practicum/Section Template/team-module-section.html" %} 

{% end_dnd_area %}
{% endblock body %}

Thank you!
Best regards,

Azhar

Hi @AzharBondi

Happy to provide guidance with your question.

For the home.html, you want to extend with the base.html, but you wouldn’t add your home.html content/sections to the base.html. This would prevent you from creating unique templates for different page types as they would all then contain the home.html sections.

Hope this helps clarify!

Hi @Jnix284 , Thank you ! I get your point !
So in this case I do extend the base within the home.html(as you can see in the code) what’s missing exactly here ?
Thank you

@AzharBondi

I see that you’ve extended the base in the home.html and that looks correct - based on the initial question (wanting to add the home.html to the base) and my response (not adding it), can you clarify what you mean by what’s missing?

Is something still not working as expected?

The home.html should reference the base.html and the template should have all of the included elements from the base.html - is this not the case?

What’s happening is:

what I have displayed on my page are just the footer and header (coming from base.html)
But the two sections I am calling here in home.html are not being called properly apparently. Because they are not being displayed.

@AzharBondi ah, ok, thank you! I thought you were trying to insert the home.html into the base.html.

The first thing I’d check is your directory path, based on the screenshot in your original post, you have three folders within the “Practicum” theme - Modules, Section Template, and Templates.

Rather than using this directory path:

"/Practicum/Section Template/two-columns-section.html"

you would use this one:

"../Section Template/two-columns-section.html"

and the second issue is that you’re using double quotes instead of single quotes, so it should look like this:

{% include_dnd_partial path= '../Section Template/two-columns-section.html'%}

One other suggestion, depending on how far you are with coding everything, would be to name your folders using lowercase and if you can’t use a single word like “sections” than use dashes instead of spaces “section-template” - I haven’t tested whether your “Section Template” with the space could be causing the issue, but it goes against the best practices I was taught.

Let me know if you can get it working with these changes :slightly_smiling_face:

@AzharBondi I just realized you’re also missing a bit of code for the include statement.

Here’s the updated code with the context added:

{% dnd_area 'dnd_area' label= 'Main Content' %}

{# Image and Text section #}
{% include_dnd_partial path= '../Section Template/two-columns-section.html' context={} %} 
{# End Image and Text section #}

{# Team members section #}
{% include_dnd_partial path= "../Section Template/team-module-section.html" context={} %} 
{# End Team members section #}
{% end_dnd_area %}

Hello community,
i came across this because i faced the same issue and this thread motivated me to test some behaviours.

I have been working on a landing page template. The template was already selected, and I was in developerMode to regularly reset the content. To outsource section templates, I then used the include tag

include_dnd_partial

The section was not displayed, but rather a broken module without a label. Resetting the content did not change this.

I then tried to view my landingpage template using thepreview in the design-tools. There, all sections were displayed.
What actually helped me:
I deleted my landingpage and recreated it with my template. Everything is now displayed correctly.
Resetting the contents in developerMode also works without any problems.

I use the include_dnd_partial tag without a context attribute, as this seems to be undocumented. I also use double quotes, as was shown in the documentation as an example.

{# Form #}
{% include_dnd_partial path="../sections/landingpage-pullup-form.html" %}

Thanks for sharing @JanRa, hopefully this helps @AzharBondi resolve the issue as well!

Regarding the double quotes vs single quotes and context, you can find the documentation for adding a section partial to a template here where it shows the code I recommended.

I do think both work, but I wanted to be sure it wasn’t a syntax error before getting too far down the path of troubleshooting the issue.

Thank you I appreciate your help !

Hey again @Jnix284 , still no changes maybe I need to delete the landing page and recreate it like @JanRa suggested ! If it works I will let you guys know ! Thank you for all the help provided

you’re welcome, hopefully creating a new landing page works!