Understanding the proper way to handle attachements ("assets")

hope that the answer is not “logseq is not the right tool for you”…

actually I want to have only one tool to store my knowledge base, don’t want to lookup several apps to find the needed information
this not only includes text but also PDFs, pictures, Screenshots etc
examples of content could be hardware inventory including picture of the device and PDF of the manual, or PDF books / articles with some comments or links to other pages (eg an article on ssh with links to other pages about ssh) also sometimes I capture the screen of PCs with my mobile phone’s camera when selecting text and doing copy/paste is not possible (eg sitting in front of servers) and only add small amount of text to it - one picture tells more than thousand words

I’ve seen that there is the assets directory but in my understanding it lacks structure. meaning files are stored flat and I would have to take care of name de duplication, proper naming (to prevent having files named screenshot1.png lying around with no human-visible connection to a specific page) etc
maybe what I’m looking for is a kind of page-linked assets directory, but I understand that this would be the least efficient implementation

so am I a weirdo trying to store kind of multimedia content in logseq or how do others do?

many thanks

4 Likes

Managing files is a legitimate use case in my opinion and I’m going to explore it more too.

Did you already notice that you can change the path of an asset manually?

I mean, when you upload an asset you will get a link like this:

[Name.pdf](../assets/Name_1658000515517_0.pdf)

If in your assets folder you create a subfolder you can edit the link like the following:

[Name.pdf](../subfolder/Name_1658000515517_0.pdf)

(notice that it’s ../subfolder/ and not ../assets/subfolder/ in the link above as one would expect, I don’t know why).

Maybe you can move all the files you want to manage into the assets folder and manually link them in Logseq when needed instead of using the Upload an asset command?

Is this enough to address your use case?


Edit: don’t forget that URLs work too, so you can link files on a web server too. For example the following PDF can be annotated as a local one:

![Analytic Geometry](https://www.math.uni-bonn.de/people/scholze/Analytic.pdf)
3 Likes

I may not be understanding your problem, but in my opinion I don’t care what the folder structure looks like in assets. The human visible connection in my opinion all happens in Logseq itself.

Once I attach a file I have no issue ever finding it because I can search the tags, page refs etc.

I lose lots of items on my desktop but once I add a pdf to Logseq its instantly retrievable in my opinoin.

1 Like

In addition to the human readability, there is also the issue of accidentally creating file names that are too long or too long for other programs to properly handle, or folders that have too many items, as discussed in the thread below.

Human readable names are definitely a big plus, especially to re-use the assets by name in other blocks without having to copy links to cryptic filenames, but first Logseq should guarantee that its storage is technically sound and nothing breaks years down the road on another device.

2 Likes

As the OP I just wanted to thank you for the feedback. Conclusion is that there doesn’t seem to be a prefered nor “official” way, it has to be defined by each user.
Still playing around with lopgseq but with low prio / available time.
Digging a bit more into the topic, I’m trying to find out what’s the best way to structure my assets directory and linking intomy notes
Will post here when I’ve made up my mind and found a way to go

You’re not weird. This is why I’m still mostly using Obsidian over Logseq: Obsidian has a better and more consistent philosophy; just like it’s based on markdown for human readability, it fully respects the file system and directory structure for human organization.

3 Likes

Honestly, I don’t even think any user of Logseq should be thinking about “how to structure their assets”.

While it is ok for Logseq to have a folder where you put the files that have no other home, everyone already has tens of thousands of files on their disks, and users can’t be expected to put everything into some new structure Logseq likes.

Many other programs also made this mistake, which makes it impossible to interface with other programs that also want to own all of your data.

Take for example Zotero, they have a good case for having their assets all in a single storage folder. Unfortunately Logseq can’t have relative paths to these files, so they either have to be duplicated, or use absolute paths, which is too fragile:

Similarly the widely used e-book management program Calibre does not permit linking to outside files at all, which makes it close to impossible to annotate Calibre books in Logseq.

In my opinion, Logseq should re-think their asset strategy and try to become as non-intrusive as possible and seamlessly fit into existing OS folder structures.

Logseq should not only do relative paths by default, but there should be a way to change and fix those paths should a user decide to move their external folders around.

6 Likes

I’d like to continue using Logseq (haven’t tried Obsidian), but have a problem that for many pages I have a need to attach a diagram attached to them, usually created as a screenshot of some other program’s output. Those attachments are then placed together with audio/video files and everything is stored under my filesystem. It goes like /home/userid/Documents/somesubfolder/examples/example-abc/. However, when I attach screenshot image to my Logseq page, then all those folders (/home/, /home/userid, /home/userid/Documents etc.) are created as nodes in my Logseq graph which I’d like to prevent. They are just storage hierarchy in my filesystem and not something which adds logical value to my personal knowledge database. Moreover, I do anticipate having a lot of such note pages created during my study work and those extra notes will just create a noise which I’d like to prevent.

Any hint how to properly handle it in Logseq?

How is such a case handled in Obsidian?

Sincerely,
Saša

1 Like

@gour regarding the issue with the directories created as pages : instead of creating links as file:///home/userid/… simply write them as file:/home/userid/… worked for me

1 Like

Those paths are completely ignored. But I can’t even reproduce what you’re saying of the behavior in Logseq. When I drag an asset into a page, I don’t get the parent folders created as nodes. Can you give a screenshot?

Thanks a lot - it works for me as well!

Just use the example as mentioned by @jhf2442 .

Here it is:

I am having issues with version control.

As far as “official ways”, my thinking has evolved to now consider that there are. To summarize: a knowledge/note management system is different from a document management system.

I was trying to squeeze my documents into obsidian, not Logseq, but for this point I think they can be considered the same (as we are only referencing documents within markdown notes).

I’ll give an example. Let’s say I have a tax document scanned. In my mind it belongs in categories: “taxes” “2021” “business A”. Maybe “archive”.

A “document management” approach would mean simply tagging the document with those attributes. Done. It doesn’t need a note.

To squeeze it into a knowledge management system I would make a note called…… something. (First sticking point). And then tag that note with the same tags. But notice the document itself still isn’t tagged. So when I want to find it, Im looking for a note, instead of the document itself. It’s an added layer, and a fragile one. If that note or the links disappear for whatever reason, my document is in a pile of others in /assets.

So “Documents” with a capital D don’t go in my PKM. Operating and file systems were designed decades ago for this specific task and do a fine job of it. But screen shots and other smaller assets that help create a note, help define the Knowledge, I do include in a PKM.

The lack of namespaced asset management is one of the biggest pains of using logseq in my opinion.

Most knowledge professionals require the ability to segregate portions of the graph. It’s bad security hygiene to have all notes under the same undifferentiated namespace. It’s essential that medical notes stay on the device that’s appropriate for that level of sensitivity, or that my answers to my class quiz questions not be shared publicly just if I want to share some lecture notes with another individual, or that some confidential employer notes not be mixed up with my casual notes and thereby migrated to my tablet or phone.

Of course, one can use multiple graphs, and I’ve experimented with that - but that basically ends up producing notes that are not that useful, since your notes are only as good as the number of milliseconds it takes you to look something up.

The way I’ve handled this up until now is to have everything that’s confidential be under a hierarchy with a four code prefix. That way if I want to share other files, I just need to exclude all the ones that begin with the confidential domain’s code.

This all breaks down in asset management, however, when in order to upload a file and have the hierarchy prefix, I need to manually rename it.

What’s really needed is

  1. to be able to load multiple databases into one view, to be able to hyperlink to them, and to keep them separate
  2. have an option to have every asset that’s uploaded a given page have that page’s name prepended to the file name.

That way I can clearly see all the page and assets that shouldn’t be brought over from one environment to another.

Of course, it would be even better if there were folders, since ideally a knowledge base wouldn’t be a one-homed solution but rather something like a package manager, where you could install and write to your “python” notes separately from your “work” notes.

2 Likes

This implies that each asset is used on a single page only. This is usually the case, and for the remaining cases it could be optional, but it’s a problematic design. Ideally, there should be some custom filter that determines what is sensitive or what is exported.

You haven’t mention subfolders in the graph folders and why it doesn’t work for you. Are you aware of subfolders? They are mentioned in my reply:

A custom filter for exports sounds like a sensible feature. I haven’t used custom filters or exports; for all I know this could already be a feature of logseq for exporting. I’m not quite sure how it would work, for example, where would the file metadata (e.g. some tag Public or Friends) that would be “filtered” be stored, in some .edn file? I personally haven’t ever had the need to export a sub graph, but I can imagine this would be important for those who need to do so. I can imagine a scenario where I might choose to export a sub-portion of the graph containing non-sensitive data to a vector database for use in RAG. I can think of more use cases where one would want to default the graph to private and then open up certain pages than use cases where one would want to default hte graph to public and then filter certain pages.

If I add an asset to page A/B/C and it were automatically added in a namespaced way in a folder assets/A/B/C, and then I used the file page D, then upon export, I would expect that the page D would simply have a “dependency” on pages A/B/C and their assets that must be met by the target environment, and would have a “dangling pointer” otherwise. I might also expect a warning message to be generated that could be used to prevent export in that case. I would prefer that approach (namespaces for asset management) to having some assets astonishingly included in exported assets that then need or require a custom filter to prevent their export.

The use case I feel most acutely is the need to segregate sync’d sub-graphs to only certain devices / environments that should have access, not exporting. I want to have parts of my graph installable as read-only or read/write “packages” from different git repositories. Each environment should only have access to the knowledge repositories / namespaces they should be able to access. Some of these so-called “packages” could be public (for instance, my notes on books or on math might as well be public; they might be useful to others). Other packages need to be private to me, and only allowed to be on some strict subset of the devices on which I use Logseq, not all of them.

Thank you for the recommendation. I’ve been meaning to try that out. That would be a suitable manual workaround until some kind of plugin or logseq default behavior can be modified so as to make it automatic. I will likely start doing this soon. One good thing about having flat-ish asset hierarchies right now is that it should likely simplify the process of scripting the update. Of course, it probably would be better if there were a standard “move asset” plugin that was well tested …

I tried Obsidian partly because of its support for folders, which are in my opinion cognitively easier to reason about when it comes to permissions. I found the asset management wanting there as well; one may manually and statefully mark different folders as asset folders at different times. This seems error-prone if you wish to maintain an invariant that one’s assets are near the folders in which they are intended to be used and whose pages reference them.

I don’t understand why both Obsidian and Logseq seem resistant to having assets automatically upload adjacent to the page they are uploaded to. If there were a fork of Logseq that stored namespaces in folders and included the assets in those folders, I’d probably jump to that fork. Then I could use git submodules or other solutions to manage all the namespaces with different repository-level permissions. Ideally, there’d be some public knowledge package manager, so you could publish some namespace or install someone else’s, or perhaps even use a query to install some sub-portion of another’s “knowledge package.” This would facilitate personalized RAG-type architectures that I imagine could drive the next level of knowledge work.

1 Like

And yet it is not good for security. The problem of handling assets extends to pages as well. Here is an interesting thread (beyond the OP): “Introducing ‘Views’: A Flexible Solution for Graph Organization and Content Separation in Logseq”

1 Like

I don’t know if this is helpful but I’m coming to Logseq from the other side where I have used Notion and now exploring Logseq for my user case. I already have a well functioning asset management system in Notion using the PARA method for storing reference documents in their appropriate area. Notion has good functionality in this regard with database views.

I’m more looking at Logseq from the possibility of somewhere I can perform ideation efficiently and as part of that store links which are relevant in that process.

1 Like