Allow assigning CSS class to listing items via YAML params #8757
Replies: 2 comments 3 replies
-
Thanks for the feedback. Your link does not work. Private repository? Why not target CSS/HTML elements to customise your listings? It works pretty well. |
Beta Was this translation helpful? Give feedback.
-
Thanks. Apologies, repo now made public. For targeting all items, what you suggest would work. But it requires overriding rules and also targeting specific #elements, so I though assigning a class to all items in a specific listing would make this more straightforward. But I agree this use case can be served without any new feature. For assigning a different CSS rule to each listing item (or, more likely, groups of items), this would have to currently be done by matching text or targeting elements via some |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
For listings, especially of type
card
, it would be helpful to be able to assign a CSS class either globally via a param in the listing YAML setting and/or via a field within each item (when content is defined in YAML, this is easy - it's not clear whether this is feasible for listings where content is derived from the file structure).This would make it easy to (a) style whole listings via CSS and (b) create a visual key to different types of listing items.
Currently, this requires creating a custom listing where only one line of code of the EJS template differs from the built-in default.
An example implementing a combination of both approeaches (applying a class to all listing items, currently via
template-params
and a local one via a custom field, is at https://github.com/petrbouchal/pank-cz/blob/live-prelim/ejs/inspirace.ejs.Beta Was this translation helpful? Give feedback.
All reactions