9+ Obsidian Dataview: Hide Empty Query Results

how to make dataview disappear if not results obsidian

9+ Obsidian Dataview: Hide Empty Query Results

Conditional display of dynamic content within notes, generated from the note’s metadata and content using a query language, can be achieved through clever use of inline JavaScript within Dataview queries. This allows the query results to be evaluated, and if no results match the provided criteria, the entire output, including any surrounding markup, can be suppressed. For instance, a DataviewJS query can check for the presence of specific keywords or tags within a note, and render content only when those conditions are met. A practical example involves displaying a specific section of a project overview note only if the project is marked as “active.”

This dynamic control over content visibility offers significant advantages for note organization and knowledge management. It allows for the creation of flexible and adaptable templates that adjust their output based on the data within each note. This minimizes clutter and presents only the most relevant information, streamlining workflows and enhancing the usability of interconnected notes. Historically, achieving such dynamic behavior required more complex workarounds or third-party plugins, but with the integration of JavaScript into Dataview, this functionality becomes more readily accessible.

Read more