connertennery/Notion-to-Obsidian-Converter

Attachments in Obsidian

Closed this issue · 4 comments

I'm new to the whole Obsidian world, and something that I have not fully understood is the concept of attachments and attachment folder.

When I use your cli to convert my Notion files to Obsidian, it will create a folder hierarchy in which the .md file is accompanied with an attachment folder (with the same name) which contains images OR it might be Level 2 notes and their attachment and so on. Let me give an actual example

Here in my notion I have a Work folder which contains two sub folders

  • AWS Key which is a page
  • CircleCI which is a folder containing two pages

image

Running this repo cli will result in
image

At first glance I see that each page has a sibilling attachment folder (if it contains images etc.), but dragging and dropping them in the Obsidian vault will result in weird hierarchy

image

which is a mix of attachment and pages.

Do you have any comment on this issue and how do you imagine someone using your cli for converting nested pages (folders) from notion?

Does it makes sense for the cli to accept an option like aggregate attachments into a single folder in the root and all pages' links gets updated accordingly? This way the nested folder in Obsidian would be only for pages (and not attachments).

Hey, @sedghi!

I can definitely see the issue you're having here. That's something I struggled to come to a decision on when making this little script. The reason I chose that layout is because it felt the most "true to Notion" and would result in the fewest name collisions. If all attachments were dropped into a single folder and all were given "Untitled n.xxx" names, then it would be fairly hard to figure out which file is which and what page it came from.

The script should certainly have an aggregate flag though. An aggregate could use the page path or suffix as part of the file name in order to show where it came from.
e.g.

  • ./Work/CircleCI/setup/Untitled 4.png becomes ./attachments/Work.CircleCI.setup Untitled 4.png
  • ./Work/AWS Key/Untitled.png becomes ./attachments/Work.AWS_Key Untitled.png

I can try to get around to that potentially soonish, but if you'd like to submit a PR then I can review it.

In the meantime, a shell script could aggregate attachments, but there won't be proper linking in your notes.

find . -regex '.*\.\(png\|jpeg\|jpg\|gif\|pdf\)' -exec mv {} ./attachments \;

I think that should do it in a pinch.

Thanks for your prompt reply!
Yes the path-aware image name makes sense or even the same folder hierarchy such as attachments/Work/CircleCI/Setup/Untitled4.png

I guess either of these would solve the messy note hierarchy, but then creating new notes and inserting media would put the file at the same folder level; I guess that is not an issue with this repo, and more like attachment management issue/question in obsidian, but would like to also know your take on that: Is there any way to tell Obsidian that when inserting a media check the current note relative-to-root path and insert it in the attachment folder same path. So like if I'm writing a note in work/stuff/newNotes/note1.md then inserting an image would just put it automatically in the attachments/work/stuff/newNotes/note1/untitled 0 .png.

Yeah that's another way you could do it! I suppose it's all up to personal preference.

There are a few options for attachments in Obsidian! Thankfully, the devs have been pretty accommodating in providing lots of options and of course there are always plugins.

To change your default attachment location for new attachments:

  1. Open Settings by selecting the gear icon in the bottom left corner of Obsidian
  2. In the dialog that opens, there is a list of setting categories grouped by sections. Under the topmost section "Options" select "Files & Links"
  3. Scroll down a bit in the settings until you see "Default location for new attachments"
  4. Select the option that best works for you

(I'm using version 0.15.9 right now. And if you're curious, my theme is Yin and Yang and I'm using dark mode.)

image

Also, here's a link to the Obsidian community if you need more help or have any suggestions! I don't participate frequently, but everyone has been great so far.

Thanks a lot @connertennery you are awesome