Skip to content

Feature request: Add class(es) to pages based on some programmable logic #48

@voltel

Description

@voltel

I have a property on the page that denotes the expiration date.
E.g., in the frontmatter properties YAML, it could look like this:

---
expiration_date: 2023-11-01
---

Or it could be in the body of the page as a Dataview metadata property:

[Expiration date:: 2023-11-01]

I'd like pages that are viewed past the expiration date to have a special CSS applied.

For that, certain logic should be run for the page.
As Dataview works with properties and metadata on the page, it seems to be a choice to allow the user to configure a certain module which will export a callback function, which will be invoked with a current page in a parameter and Dataview global instance, if present. If this function returns True, the plugin will add the configured CSS classes to pages, or, if it returns a String or an array of Strings with CSS class names, will adds those.

This will allow having a more elaborate logic for marking pages with certain CSS classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions