0

I need to theme the first row of a view page with a different image size and the theme debug suggested me:

node--view--article--page-1.html.twig

This is new on drupal 8.

I was wondering if is possible to get template suggestions per row number.

1

This is probably not a simple task for a template name suggestion, because at the time of rendering the node is unaware of where it is placed in the view.

So a better approach might be to use two different view modes, one for the first and one for the rest of the nodes. Then use a row style plugin to switch the view modes, for example the module Views Parity Row.

If this is only to apply CSS, then don't try to add row classes to the node. Add them to the views row container and target elements inside of the node with multiple CSS selectors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.