Get AI summaries of any video or article — Sign up free
DataviewJs Code Snippets For Obsidian You Must be Using thumbnail

DataviewJs Code Snippets For Obsidian You Must be Using

Prakash Joshi Pax·
5 min read

Based on Prakash Joshi Pax's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Tag Cloud and Page Cloud snippets provide clickable navigation over tags and pages, but large vaults benefit from folder-scoped queries to avoid performance hits.

Briefing

Obsidian users looking to turn plain notes into dashboards get a practical set of DataViewJS snippets—ranging from tag and page “clouds” to habit trackers, progress analytics, and folder-based tables of contents. The core payoff is speed: many snippets work out of the box, while the ones that depend on personal note structure can be customized by editing a few folder paths, property names, and thresholds.

A standout early example is a Tag Cloud that renders every tag in the vault with counts, and links each tag to a filtered search view for that tag. A related Page Cloud (called “pH Cloud” in the transcript) lists nodes in a visually navigable format and can be configured to query only nodes from a chosen folder—an important performance consideration for large vaults. The transcript also highlights Table of Contents-style views that generate an outline for all notes inside a folder, but only when a note exists whose title matches the folder name.

For tracking behavior over time, the transcript walks through two habit-tracking approaches. One version tracks habits via Daily Note properties: it calculates streak-like checkmarks by reading structured fields such as writing, exercise, and reading, then marks completion with a check icon or an “incomplete” red box. Customization is required—especially the folder path used for daily notes and the property names inside the Daily Note template. The walkthrough shows how to expand beyond the default three habits by adding new properties (for example expenses, XP, and day plan), then adjusting the DataViewJS logic so goals only count when minimum criteria are met (such as requiring at least six focus sessions rather than any nonzero value).

A second habit tracker logs events instead of relying on properties. In this method, users write a log entry in the Daily Note (e.g., “day plan,” “exercise writing,” “reading”) and the snippet interprets those tasks as habit activity. The transcript notes that this approach still needs edits—such as start dates and any vault-specific paths—because the snippet may be copied from an external forum.

Progress tracking is handled with two complementary snippets. One adds start and end date filtering so totals for a property (like XP) can be computed within a time window; a bug in the initial setup is corrected so values are added properly rather than concatenated or mis-summed. Another builds a progress bar in a table view using properties like goal, progress, and deadline; the transcript emphasizes that property names and casing must match exactly (e.g., “deadline” may fail if the snippet expects a different case).

Finally, the transcript extends the same progress-bar idea to a book/library database. A book progress widget computes completion percentage from properties such as current page and total page, and can be enhanced with Minimal Theme card styling via CSS. The closing sections return to navigation snippets—alphabetized lists and folder-scoped “P Cloud”—and stress that querying the entire vault can slow down large libraries, so folder scoping is the safer default. The overall message: pick the snippet that matches the data model (properties vs logs), then align property names, folder paths, and thresholds to personal templates for reliable results.

Cornell Notes

The transcript provides a toolkit of Obsidian DataViewJS snippets that turn vault metadata into interactive dashboards. Many snippets work immediately (like Tag Cloud and folder-based Table of Contents), while habit and progress trackers require edits to match the user’s folder structure and Daily Note property names. Habit tracking is demonstrated in two ways: property-based checkmarks with configurable completion thresholds, and log-based tracking where tasks written in Daily Notes are interpreted as habit activity. Progress tracking adds date filtering and progress bars, but it depends on exact property names and sometimes casing (e.g., deadline). The same progress-bar logic can be adapted for book/library tracking using current-page and total-page properties.

What makes the Tag Cloud and Page Cloud snippets useful, and what configuration matters most?

The Tag Cloud displays every tag along with a count and links each tag to a filtered view for that tag. The Page Cloud (“pH Cloud”) lists pages/nodes in a clickable visual layout. The key configuration is scoping: for large vaults, querying the whole vault can cause performance issues, so the snippet should be adjusted to query only a specific folder/path.

How does the property-based habit tracker decide whether a habit is complete?

It reads numeric values from Daily Note properties (e.g., writing, exercise, reading) and then marks completion with a checkmark when conditions are met. The transcript shows that simply having a nonzero value may still fail completion if the code uses a minimum threshold. Example: focus sessions were set to require at least 6; adding 5 sessions left the habit incomplete.

What edits are typically required when adapting the habit tracker to a personal vault?

At minimum, users must change the folder path used to fetch daily notes (the transcript’s example referenced a “Journal” folder). They also must align property names with their Daily Note template—such as adding properties for writing/exercise/reading plus additional fields like expenses, XP, and day plan. If the snippet is copied from elsewhere, start dates and other hardcoded values may also need adjustment.

How does the log-based habit tracker differ from the property-based one?

The log-based snippet tracks habits by reading entries/tasks written in the Daily Note rather than reading structured properties. Users write a log line for a habit (e.g., day plan, exercise writing, reading) and enable the relevant option so the snippet interprets those tasks as habit events. It still requires vault-specific edits such as start date and any referenced paths.

Why can progress totals be wrong even when the snippet is correct, and how was it fixed?

The transcript describes a case where XP totals appeared incorrect (showing an unexpectedly large number). The fix involved correcting how values were aggregated so the snippet adds each node’s property value properly rather than mishandling the sequence of values. After correction, adding a new XP entry (e.g., 100) increased the total to the expected result (e.g., 410).

What commonly breaks the progress bar table view, and how is it debugged?

Progress bar issues often come from mismatched property names or casing. The transcript notes that headers like goal/progress may not match what the snippet expects (e.g., using “Target” vs “goal”), and that “deadline” may fail unless the snippet references the property with the correct lowercase/uppercase spelling. Debugging involves editing the snippet’s expected property identifiers until the table renders correctly.

Review Questions

  1. When adapting a property-based habit tracker, which three categories of changes are most likely required (and why)?
  2. How would you modify a habit tracker so a goal counts only when a minimum reading duration is met?
  3. What steps would you take to troubleshoot a progress bar that shows 0% or fails to read deadline values?

Key Points

  1. 1

    Tag Cloud and Page Cloud snippets provide clickable navigation over tags and pages, but large vaults benefit from folder-scoped queries to avoid performance hits.

  2. 2

    Property-based habit tracking depends on exact Daily Note property names and the daily-note folder path used by the snippet.

  3. 3

    Habit completion can be threshold-based; nonzero values may still count as incomplete if the code requires a minimum (e.g., focus sessions ≥ 6).

  4. 4

    Log-based habit tracking interprets tasks written in Daily Notes, requiring edits like start dates and vault-specific paths.

  5. 5

    Progress tracking with date filtering requires correct aggregation logic so property values add correctly across multiple notes.

  6. 6

    Progress bar table views are sensitive to property identifiers and casing (e.g., deadline may break if the snippet expects a different case).

  7. 7

    Book/library progress can be computed from current-page and total-page properties and enhanced visually using Minimal Theme card CSS.

Highlights

A Tag Cloud renders tags with counts and links each tag to a filtered search, turning metadata into a navigation layer.
Habit tracking can be made strict: setting a minimum threshold (like focus sessions ≥ 6) prevents partial progress from being marked complete.
Progress totals can be wrong due to aggregation behavior; correcting the summing logic makes new entries increase totals as expected.
Progress bar tables often fail because property names or casing don’t match exactly—debugging means aligning snippet expectations with the vault’s property schema.

Topics

Mentioned