Do I need to change the date format in the code to my own (DD-MM-YYYY as set in Daily Notes) ?
I don’t seem to get it working, I get the hint between () and have named the notes with today’s date in the aforementioned format, but I get no navigation.
Unless this is already possible in DataviewJS, please find in this forum as well as in Dataview’s github a FR for embedding local media (audio, image and video) in a dataview query (table, list, etc…), possibly using relative paths inside vault for better cross-platform portability.
---
abandoned: null
release date: 1970-01-01
pageprogress: null
pagecount: null
Author: Becky Chambers
Title: A Closed and Common Orbit
Series: Wayfarers
number-in-series: 2
time-read: 2020-08-20
Mood: 😭😭🥰😭
tags: book
---
This is what my book notes look like. time-read is the date I finished the book. date-published/release date is essentially what it sounds like. There are a lot of books coming out this year that I want to read, and I don’t want them to get buried, so I thought it would be good to keep it organised.
Not quite sure why your currently reading is at the bottom. But if you have more books in that than in your unreads, that might have something to do with it.
Thank you for sharing. Yeah I can’t figure it out either. I do have more that are unread than currently reading. Have you made a table for books that you have read?
EDIT: I figured out shat the problem was with is being reversed. I was using a Emoji in my title which was causing it to reverse.
I’ve been holding off on submitting a few of my snippets here just to make sure they’re not a fad… but it’s been a few months now and I have to say one dataviewjs block that’s really improved how I use Obsidian has been having a block that nicely displays all the inlinks to a given file.
// Nicely Render all the inlinks to the current note on a single line
// Checks if an alias exists for inlinks and will render the alias
// if it exists
//
let myInlinks = [];
for (let inlink of dv.current().file.inlinks){
if (inlink.path != dv.current().file.path) {
let inlinkFile = dv.page(inlink.path).file
let displayName = inlinkFile.aliases ? inlinkFile.aliases[0] : inlinkFile.name
let fileLink = dv.fileLink(inlinkFile.path, false, displayName)
myInlinks.push(fileLink)
}
}
let myInlinksStr = ` **Inlinks**: ${myInlinks.join(', ')}`
dv.paragraph(myInlinksStr)
How it works
Get all the inlinks of the current file
Iterate through them, ignoring any self reference (such as internal header links)
Get the inlink file object to read it’s data
Create a dataview fileLink, using the first inlinks alias as the displayname if there’s an alias.
Push all the fileLinks into an array
Render a comma separated list of the fileLinks with a prefix of Inlinks
I find this significantly helps me flow through my notes and lets me links files an organic way.
My typical journeys might be:
I create a note about a new takeaway place i’ve tried, and link it to my notes on Deliveroo, Chinese Food, Local Takeaways, Cheap Eats etc. Infact, i’ve more or less forgone using tags at all now in preference of notes as tags since I find they serve the same purpose with more utility.
By using the dataviewjs I can have more control over the format like using the alias for example. I often use aliases for my Map of Content (MOC) notes.
The only minor issue i’ve had that’s probably worth mentioning is on the new creation of a file, the parent inlink won’t automatically show since it’s not present in the file.inlinks array. But if I really need this immediately, I can reload Obsidian and it’ll update.
Another fairly simple example of using the dataviewjs cobeblock to style data I find useful is note descriptions. In my default note template I have a description key to give a summary of what the notes about. Depending on what the notes about, this can be useful, other times it’s not relevant.
# {{title}}
``` dataviewjs
let page = dv.current();
if (page.description){
dv.paragraph(
"**Description:** " + page.description
)
}
\```
Originally, i’d have a line with **Description:** Notes about {{title}} just under the note title. But then I was getting annoyed by how redundant this was so I just shortened it to **Description:** which I wasn’t getting on with. When notes didn’t need it, i’d either remove it, which I don’t like, to me, my note templates are there so I can immediately focus on outputting the content of the note and minimising the amount of time or thought I spend on styling… but If I didn’t delete it, on revisiting the note I’d catch myself thinking about what this notes description was and trying to “complete” this seemingly incomplete prompt.
When I started adding YAML to my notes, I liked the idea of notes having a description field, since I could potentially see creating query based tables that displayed this field. So I tried just adding an inline metatag description::, only when needed, but to me this just looked a bit ugly and I would habitually default to Description::.
With the dataviewjs plugin I can have my cake and eat it. Now in my daily note I have an empty description metatag that will render once it has a value. Letting me focus on the content, not the styling.
I quite like this design pattern, and can see myself reusing it for other metatags. I have a few different note templates which I’d like to keep to a minimum since alot of them share the same components that I continue to evolve and maintain, I can see conditional rendering using the metadata as a method of keeping a few flexible note templates that have consistent styling.
Final example i’d like to showcase, is how I use dataviewjs for styling in my Beer notes.
I’m an occasional beer drinker, love trying different ones, always forget which I like and where I got them. For ages I wanted to be able to have a personal way of keeping track of what I liked and disliked, but at the same time, have it quick to do, otherwise I won’t do it. After a bit of refining i’ve settled on a note template that works well for me that looks something like this:
N.B. If you look close you’ll see a few minor inconsistencies in the code snippets across my showcases, since my templates and queries get a bit more evolved. Ultimately Obsidian is a tool for capturing knowledge for me so I try not to be too disciplined or care too much about the underlying consistency unless I have a reason too.
Hi,
I have been working on my daily and weekly notes and I would like to share my snippets that I use for my daily and weekly review.
Although dataview dynamic table are great, I think a static tables are useful to review the notes that I worked every day. Furthermore, are useful to plan the next day or when I’m doing the weekly review, and also I found it useful to do a project inform.
The filePath() function just checks if the string starts with http, and converts it to an internal link otherwise, using the vault.getResourcePath function.
A minor inconvenience is that getResourcePath needs the full path to the images. So attachments/example.png works, but just example.png,  or ![[example.png]] doesn’t. But It can easily be upgraded with more checks to parse wiki links, markdown formatted links, etc.
Hi, don’t know if this is the correct place to post, but i created a plugin that works on top of DataviewJS to display progress for whatever you want to track. Picture says it all i think:
This snippet allows you to see all your dangling links.
You can configure how many connections each link has to have before it shows up.
You can also exclude existing and non-existing files from showing up.
//how many links a non existing file should have at minimum
const count = 2;
//specify the full path here.
const ignoredExisting = ["your/ignored/notes/here.md"];
//keep these in lower case.
const ignoredNonExisiting = ["your non exisiting notes", "here is note that does not exist"];
let d = {};
function process(k, v) {
Object.keys(v).forEach(function (x) {
if(!ignoredNonExisiting.includes(x.toLowerCase())) {
x = dv.fileLink(x);
if (d[x]==undefined) { d[x] = []; }
if(!ignoredExisting.includes(k)) {
d[x].push(dv.fileLink(k));
}
}
});
}
Object.entries(dv.app.metadataCache.unresolvedLinks)
.filter(([k,v]) => Object.keys(v).length)
.forEach(([k,v]) => process(k, v));
dv.table(["Non existing notes", "Linked from"],
Object.entries(d)
.filter(([k, v]) => v.length >= count)
.sort((a, b) => b[1].length - a[1].length)
.map(([k,v]) => [k, v.join(" • ")]));