Allow app blocks between article sections#52
Open
patrickbolle wants to merge 1 commit intoShopify:mainfrom
Open
Allow app blocks between article sections#52patrickbolle wants to merge 1 commit intoShopify:mainfrom
patrickbolle wants to merge 1 commit intoShopify:mainfrom
Conversation
Currently, app blocks on the article page are forced to render below all article content. Unlike the product page where app blocks can be placed between sections (e.g. between title and price), the article page pins its blocks to fixed positions using static content_for calls. This changes the article section to use content_for 'blocks' so that all blocks — including app blocks — render in the order merchants arrange them in the theme editor. Changes: - Replace pinned content_for 'block' calls with content_for 'blocks' - Remove static: true from article template blocks - Add block_order to preserve default ordering - Add _blog-post-* types to section schema (required for non-static) - Move image nil guard into _blog-post-featured-image block itself
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
App blocks on the article page are forced to render below all article content. Unlike the product page where merchants can place app blocks between sections like title and price, the article page pins its blocks to fixed positions using static
content_for 'block'calls, withcontent_for 'blocks'only at the bottom.This is extremely limiting for apps that interact with blog post templates (eg. my app, Recipe Kit). Our team spends hours every week working with merchants to simply place their recipe card in a good looking spot on the Horizon theme - but this fix will resolve that for us and all the other blog post apps.
Solution
Switch the article section to use
content_for 'blocks'(the same pattern used by_product-details) so all blocks render in the order merchants arrange them in the theme editor.Changes:
content_for 'block'calls withcontent_for 'blocks'inmain-blog-post.liquidstatic: truefrom article template blocks and addblock_orderto preserve default ordering_blog-post-*types to the section schema (required once blocks are no longer static)_blog-post-featured-image.liquidsince the block is now self-contained