Render section with blocks use Section Rendering API.
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
Hi
I use the Section Rendering API to render the content of a section but the problem is that it cannot render the blocks that the section owns.
Example:
<div class="section-blocks">
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'title' -%}
<span>This is title</span>
{%- when 'text' -%}
<span>This is text</span>
{%- endcase -%}
{%- endfor -%}
</div>
{% schema %}
{
"name": "Demo section",
"tag": "section",
"class": "demo-section",
"settings": [],
"blocks": [
{
"type": "title",
"name": "the_title",
"settings": []
},
{
"type": "text",
"name": "the_text",
"settings": []
}
]
}
{% endschema %}
Normally, it will display the following content.
<div class="section-blocks">
<span>This is title</span>
<span>This is text</span>
</div>
But when using Section Rendering API, the content is only:
<div class="section-blocks"></div>
Section Rendering API does not support rendering blocks?
Or did I miss a document or tutorial?
Can someone explain it to me, thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Section Rendering API scenario using the Liquid section and block example in the issue. Compare the normal render with the API response, then establish whether block rendering is supported and what behavior or documentation would define the issue as resolved.
Written by the indexing model from the issue text.
Assessment
- Domain
- api
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100