Skip to main content

Obsidian gallery view for notes using Dataview plugin

The code provided below utilizes dataviewjs for querying notes within the vault and showcasing their content (specifically the initial few lines).

This is a very basic version that only displays the title and the initial few lines of the content. The content is parsed as plain text, hence it cannot render images at this stage.

async function loadAndDisplayTaggedContent(query, maxFiles = 1000, linesToShow = 10) {
const taggedPages = dv.pages(query).sort(p => p.file.ctime, "desc").limit(maxFiles);

for (const page of taggedPages) {
const content = await;
const lines = content.split("---").slice(2).join("---").split("\n").slice(0, linesToShow).join("\n");

dv.paragraph(`# <PrivateInternalLink>${}</PrivateInternalLink>`);

loadAndDisplayTaggedContent('"10 Card Library"');


Pasted image 20240105014630.png