HUGO

Pass parameter through .Render?

On a list page, I’d like the first 6 list items to use loading=eager, and the others to use loading=lazy.
Is there any way to pass a counter through to the li or summary view, or for it otherwise to know its order?

I don’t think so. I’m cc’ing @regis as I know he has fumbled a lot with the .Render method.

A hacky workaround would be to create summary-eager and summary-lazy templates.

1 Like

Not possible using .Render but there is a conversation you can join: Make the argument to .Render (optionally) be a map with type and layout keys · Issue #8182 · gohugoio/hugo · GitHub

In the mean time, I’ve resoled to use partials for your particular use case. You can also find my own two cents about .Render and partial here

1 Like

Thanks very much. I suspected this was the case.