Note contents grouped by folder names (dates)

I read all obsidian documentation and did not find solution to dateview my notes like I want to.

What I’m trying to do

My note structure is like:

  • 2023
  • 10
    • 2.md
    • 1.md
  • 11
    -2.md

So I want list all my note texts grouped by formatted dates which generating by folders. So date I want to be like 02 February 2023 as group title. And then showing note content.

Things I have tried

I tried all solution here and did not find nothing which works for me.

My notes storing in folder Data.
And file for displaying notes from Data folder I created near Data folder.

It should be doable using dataview if you do something like FLATTEN list(split(file.folder, "/")) as folderParts, since you then should be able to construct a date using something like date(folderParts[1] + "-" + folderParts[2] + "-" + file.name) or something similar to that.

After that it’s a matter of grouping and displaying stuff according to the associated date.

However, you would make it a whole lot easier for yourself if you just added the full date into each file into the date property, as you then could use a much simpler query on the file.day implicit field. :smiley:

	const pages = dv.pagePaths('"Diary/Data"');
	const values = pages?.values?.reverse();
	values.forEach((pagePath) => {
		const [day, month, year] = pagePath.replace('.md', '').split('/').reverse();
		dv.header(4, dv.date(`${year}-${month}-${day}`));
		dv.paragraph("![["+pagePath+"|blog-post]]")
	})

I wrote such code. And it works. But after few seconds all posts dissapearing.

There has been an ongoing issue with Dataview related to embedding of non-images, where they behave like you describe. And I’ve not heard of a foolproof method using embeds to get this behaviour.

So if you want to include file contents you need to delve into using dv.io.load() or similar methods for reading file content from javascript.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.