What defines the order of sections in theme editor?

Short description of issue

I was under impression that sections and section groups are shown in the order they are rendered or appear in final HTML.

Reproduction steps

However I’ve encountered this – template area is above the header area.
Not on all pages though.
Does anyone knows why and how to return “header” group to be at the top?

Additional info

vs

What type of topic is this

Troubleshooting

Hey @tim_tairli,

Section groups should be shown in the order they are displayed authored within the layout file used for the template being rendered.

Sometimes I see usage where someone may want to capture content upfront and then render it later. I believe where it is captured is where it would display within the theme editor in those instances.

I did that recently with renaming policy page titles, but in my case I just left it where it was and did the find-and-replace needle-in-the-haystack approach, then output the content. (I also used to do that with checkout.liquid to inject and replace content within the checkout when clients asked if that was possible to do.)

1 Like

Thanks @RobDukarski that was my understanding too.

And the layout is the same and is standard, but some pages show header group on top while some do not.

But you comment about capture nudged me in a right direction – theme in question has

   {% include 'pagefly-app-header' %}
  </head>

The snippet inspects the content_for_layout which forces it to render before the Header Group.

Commenting the include puts Header group back to its place in Customizer, so yes, order of rendering matters even if order in final HTML is the same.

1 Like