0

I am currently trying to learn how to create my own custom theme from scratch and right now having trouble understanding the code of DAWN theme(wordpress free source theme).

/Sections/page.liquid


<div class="rte">
  {%- if section.settings.page.content != blank -%}
    {{ section.settings.page.content }}
  {%- else -%}
    <div class='page-placeholder-wrapper placeholder'>
      {{ 'page' | placeholder_svg_tag: 'page-placeholder' }}
    </div>
  {%- endif -%}
</div>

{% schema %}
{
  "name": "t:sections.page.name",
  "tag": "section",
  "class": "spaced-section",
  "settings": [
    {
      "type": "page",
      "id": "page",
      "label": "t:sections.page.settings.page.label"
    }
  ],
  "presets": [
    {
      "name": "t:sections.page.presets.name"
    }
  ]
}
{% endschema %}
  1. I don't really understand what is "t:sections.page.name" why pick such a complex name? Does it retrieve any data from any files?

  2. where is this page.liquid being used for? It looks like a bridge that connects the theme and all other sections.

  3. My current goal is to figure out how to include all the custom section within a page template. Say if I have 10 sections writen and intended to include within a single template file. Then, I have to repeat the line {% section 'section-name' %} 10 times. And if there is more template file, the situation will just gotten worse. Is there a way to loop through all sections? Or any tutorials that I can refer to would be really helpful!

Thank you reading and answering!

Yifan Lu
  • 23
  • 5

1 Answers1

0

Here is some explanation based on my knowledge,

  1. For example, When you go to Online store -> Pages -> create a page via green button situated in the top right corner As per the screenshot - click steps where you noticed that the Theme template is Default page check the screenshot. That Default page is equal to your page.json template and inside the page.json [section/main-page.liquid] section is using.

Now here we have section/page.liquid which is basically for if we want page content inside a different page (page inside page)

Here is the screenshot of the page where we can notice that page.liquid is rendering click me

Learning Note : You can add this line <h2> Current template={{template}}.liquid </h2> into theme .liquid to check which template is rendering

  1. For all sections inside the template, I guess you don't need a loop or {% section 'section-name' %} or anything as the Dawn theme is in Shopify 2.0 where all the templates are in JSON format and sections are everywhere so you can add as many as sections you want inside the template-name.JSON

Thank you

Esha Shah
  • 3
  • 5