What I’m trying to do
I’m trying to create a note in which automatically get listed all the CANVAS I’ve created.
Maybe with Dataview or any other plugin…
Things I have tried
An attempt with dataview, but I was not successfull
I’m trying to create a note in which automatically get listed all the CANVAS I’ve created.
Maybe with Dataview or any other plugin…
An attempt with dataview, but I was not successfull
Here is a simple script which lists all canvases:
```dataviewjs
let c = Object.entries(dv.app.metadataCache.fileCache)
.filter( ([name, stats]) => name.endsWith(".canvas") )
.map( ([name, stats]) => {
const matches = name.match(/([^/]+)\.canvas$/)
return dv.fileLink(name, false, (matches ? matches[1] : name))
})
dv.list(dv.array(c).sort(l => l.display, 'desc'))
```
Update: I added a simple removal of the path and file extension, and a simple sort to make the list look a little more presentable.
Another way is to embed a query with proper backticks (not sure how to embed this in this post)
```query
file:.canvas
```
Use four backticks around code blocks to be included in forum posts, like:
```query
file:.canvas
```
Or if you want to demo how the 4 backticks would look, you can use 5 backticks
````
```query
file:.canvas
```
````
~~~~
```query
file:.canvas
```
~~~~
many thanks for the tick tips … and the chuckles!
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.