How to implement a tag named paginate like shopiffy? #403
Replies: 8 comments 2 replies
-
We do have a layout tag to make LiquidJS functionable out of the box. But other Shopify tags/filters will only be added into liquidjs if they're not Shopify business specific. Otherwise creating a plugin to maintain a given set of filgers/tags is recommended. Feel free to open an issue for liquid support while doing so, or ask a question in LiquidJS Discussion. |
Beta Was this translation helpful? Give feedback.
-
the question is how to get these variable like this in a plugin ? |
Beta Was this translation helpful? Give feedback.
-
In ruby liquid, I was able to create the paginate block by inheriting from Liquid::Block. For liquidjs, I am trying to figure out how to accomplish the same thing and it looks like the necessary components are hidden away and not exported. |
Beta Was this translation helpful? Give feedback.
-
@wuyonggang100 names in import {TagToken} from 'liquidjs' |
Beta Was this translation helpful? Give feedback.
-
@ericraio not sure what
|
Beta Was this translation helpful? Give feedback.
-
What I am looking to accomplish is creating my own for loop tag where in
shopify you can use the syntax like
{% paginate collection.products by 20 %}
{% endpaginate %}
In ruby, I accomplished this syntax from inheriting from Liquid::Block
…On Mon, Oct 4, 2021 at 6:45 AM Jun Yang ***@***.***> wrote:
@ericraio <https://github.com/ericraio> not sure what Block does.
According to this doc <https://rubydoc.info/gems/liquid/Liquid/Block>, I
suppose it's something like Tag or classes used by Tag. We do have
registerTags <https://liquidjs.com/tutorials/register-filters-tags.html>
and Drop, the latter one is not well documented but I believe it's usable.
- registerTags:
https://liquidjs.com/tutorials/register-filters-tags.html
- Drop: not well documented, but
- A sample usage can be found here:
https://github.com/harttle/liquidjs/pull/398/files
- Types doc can be found here:
https://liquidjs.com/api/classes/drop_drop_.drop.html
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#387 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAKW6G36IN4ARMRJEOZFWTUFGVXVANCNFSM5D43SL3Q>
.
--
- Eric Raio
|
Beta Was this translation helpful? Give feedback.
-
Seems like just Tag, implement something like if and register using |
Beta Was this translation helpful? Give feedback.
-
@harttle can tags perform iterations ? that's what shopify's block is doing |
Beta Was this translation helpful? Give feedback.
-
https://shopify.dev/api/liquid/objects/paginate
https://shopify.dev/api/liquid/tags/theme-tags#layout
Beta Was this translation helpful? Give feedback.
All reactions