jobindjohn / obsidian-publish-mkdocs

A Template to Publish Obsidian/Foam Notes on Github Pages (uses MkDocs)
Creative Commons Zero v1.0 Universal
563 stars 38 forks source link

No way to put images from Obsidian on your webpage #5

Closed MerchantPug closed 3 years ago

MerchantPug commented 3 years ago

I've used imgur as a workaround to this, I was wondering if it'd be possible to make a media directory for use in this.

MerchantPug commented 3 years ago

There is a way, my bad.

virtualarchitectures commented 2 years ago

If anyone comes here looking for the answer to this question: MKDocs only builds what's in the 'docs' file. To ensure your images are included in the build place your 'Attachments' folder inside your 'docs' folder in Obsidian. Don't forget to set that folder as your default for attachments in the Obsidian UI if that's your intention. When you build your site with obsidian-publish-mkdocs your images and links will be preserved so they display on your pages. However, the Attachments folder is hidden from the site navigation. That was the desired behaviour for me so it turned out simpler than I expected. I'm not sure where the configuration to hide the Attachments folder is though...but it seems to work.

ndegroot commented 2 years ago

This works, but don't forget that if you have a repo that is hosting the files, the repo should be made 'private' otherwise you're publishing all your attachments there! Or make sure you only add publishable images and other files in your repo.

One idea is to put the bulk of your attachments in a folder (Obsidian still seems to find them!) and excluding this folder in your .gitignore file see my short blog