lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.85k stars 85 forks source link

Can't loop through search.pages() using Liquid #600

Closed benjamingeets closed 5 months ago

benjamingeets commented 5 months ago

Version

Lume 2.1.4 with Deno 1.42.1

Platform

macOS 14.2.1

What steps will reproduce the bug?

Create a liquid page & try to loop using tags and search.pages("")

my liquid file:

Liquid pages loop: 
<ul>
    {% for item in search.pages('post') %}
       <li>{{item.title}}</li> 
    {% endfor %}
</ul>

output:

<!DOCTYPE html>
Liquid pages loop: 
<ul>

</ul>

(it works normaly with Nunjucks and the same tag)

You can try it using this repo: https://github.com/geetsww/lume-liquid-loop-search

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

Empty loop

Additional information

No response

oscarotero commented 5 months ago

Hi @geetsww This is a known limitation of Liquid. It seems that Liquid doesn't use () to call functions, and I'm not sure if it's even possible to pass arguments. I've opened an issue some time ago here: https://github.com/harttle/liquidjs/discussions/580

I'm not very familiarized with Liquid, but If you know a way to use the search helpers in Liquid templates, please let me know (because I was thinking of deprecate Liquid templates at some point due this).

benjamingeets commented 5 months ago

Hello & thank you for these clarifications 😁

I guess I'll just use Vento or Nunjucks (honestly they're not that different than Liquid in the syntax). But I would probably be nice to deprecate Liquid (or add a disclaimer about that on the docs).

Thanks again!