File Timeline with Dataviewjs

Hi Obsidian community!

While impatiently waiting for Datacore, I am looking to use Dataviewjs to query and display entire files chronologically as a timeline.

What I would like to display:

  • Daily notes (name of file will serve as date)
  • Books, films, etc. (date is entered in the “date” property and name of file is the title of the book, film, etc.)
    The challenge resides in sorting the daily notes’ titles and the other files’ “date” property together… is that even possible?

Things to note:

  • All dates are in the YYYY-MM-DD format
  • Daily notes, books and films are in 3 separate folders in the vault

Other details:

  • Files would be sorted from most recent first
  • Only the file name would be a clickable link, not the entire content of the file
  • File properties would be displayed

While I’m certainly thrilled about this, I have zero knowledge in Dataviewjs, so any help help will be greatly appreciated! Thanks! :smiling_face::pray:

What do you want as the end result? All content from a given date, including daily notes, books, films, etc? Or just the list of all notes related to a given date?

And do you want just for a given date, or for a range of dates since you state that “most recent” should be first? Or are we just talking about the most recent changed note for that given date? And how do you foresee the properties being displayed?

Hi holroy,

Thank you for wanting to help!

I’m envisioning all my daily notes and notes with the “date” property. So for all dates, not just for a specific date range.

I did a quick montage of what it would look like:

Let me know if it isn’t clearer!

Oh and just so you know: since I’ve seen some films and read some books more than once, there are sometimes multiple dates listed under the “date” property.

Hmm… Do you really want to gather all of your vault into one file?! Is that wise? With all the text from every file just bungled up into one big chunk of text? hmm…

Below is a query to start with which should display the file name and the frontmatter in list format for each of those files. This utilises some trickery to handle the multiple values in date (which by the way breaks the functionality of file.day which otherwise would be just dandy for this kind of stuff), into a new theDate variable.

This theDate variable can then be used for sorting, and or filtering. Notice how theBook has three entries whereas one is from january, and not included in the result image below.

```dataview
TABLE theDate, file.frontmatter
FROM
  "ForumStuff/f72/f72607" AND
  (#film OR #journal OR #book)
FLATTEN date as oneDate
FLATTEN default(file.day, oneDate) as theDate
WHERE theDate >= date(2023-12-01)
SORT theDate
```

Output in my simple test vault:

This does, intentionally, not include the file content. And you might need to switch to dataviewjs in order for it to read the content of every file in this list. That would also enable you to add headers for each file, and possibly try to reformat the frontmatter using callouts or similar. I’m not sure how easy (or even possible) it would be to replicate the properties view.

Hi holroy,

Thanks for taking the time to write this code.

With all due respect, we all have different ways of using Obsidian and although gathering all my daily notes, films and books into one journal view isn’t relevant to you, it is to me. I haven’t invented anything: Scrivener, Logseq and other PKMs display entire files in sequence, and it is a wonderful system for prose writing and reviewing.

I am not looking for a Dataview table, but to display entire file contents, and from what I know it is only possible through Dataviewjs, at least for now.

Do you know Dataviewjs? Would you be able to write that code?

Trying your Dataview code, I also realized I forgot to mention something:
To be able to include multiple dates in the “date” property, I had to set the property type to list. Then, to be able to link those dates to my daily notes, I had to write them as links (really not ideal, I know).
Here is what it looks like in source mode:

date:
  - "[[2023-04-28]]"
  - "[[2023-04-27]]"

Also, you are right, displaying my entire daily notes will be much too long of a document. Would you be able to filter the content from today to one year ago?

Thanks again for you time.