Obsidian Share - a free service to share individual notes without needing a full "digital garden". Supports themes, images, callouts, and more

There are times I want to create a public link to one of my notes, without having an entire “digital garden”.

Enter Obsidian Share, a free service to publish individual notes. To share a note, just run a single Templater script. Templater is also optional - it’s plain Javascript so you can launch it from anywhere you prefer.

See it in action here using my current theme of Primary.

Features

:small_blue_diamond: Uploads using your live theme, along with all your options and custom CSS.

:small_blue_diamond: Local and remote image support.

:small_blue_diamond: Supports anything that Obsidian Reading mode does, like rendered Dataview queries or any plugins that show content inside the normal Reading view.

:small_blue_diamond: Supports callouts with full styling.

:small_blue_diamond: Filenames are anonymised through hashing so people can’t discover your other shared notes.

:small_blue_diamond: If your shared note links to another note which is also shared, that link will also function on the shared webpage.

:small_blue_diamond: Frontmatter is stripped on upload to avoid leaking unwanted data.

Download and setup

There are two ways to use Obsidian Share. You can either run it on your own private server, or you can use my free public service.

If you want to run it on your own server, see the guide here.

If you just want to start using it without any setup, follow the Installation with Templater section in this setup guide.

7 Likes

Small bugfix for linking notes without any frontmatter. Thanks user “gapmiss” on Github.

@AlanG Thanks for the fix and additions … slick script. I’m using it to publish to local LAMP server which is served to the PUBLIC internet via LocalXpose. The only real downside thus far is the size of the CSS file. ~6.5M for “Minimal” theme.

Thanks, much appreciated!

Agreed. This was the one thing I couldn’t decide on. Some of the theme CSS files are completely blown out by including the fonts encoded inside the files themselves. So on the one hand it’s really nice to have your shared links looking exactly as you’d expect them, but on the other hand it’s completely ridiculous depending on the theme. The default theme is 280kb.

On the sharing side, I separate it out to its own CSS file so that you get a benefit of caching with multiple shared files. I might see if I can stripe out the encoded fonts. I hadn’t realised any themes were as big as 6.5MB, so that gives me a good reason to check into that.

Thank you for the UPLOAD_CSS option.


I tested some various “link” methods

success:

  • [[note 1.md]]
  • [[note 1]]
  • [[file-name.pdf]]
  • [file-name.pdf](../../path/to/file-name.pdf)
  • [note 1](note%201.md)
  • [note 1](../../path/to/note%201.md)

fail w/ TypeError: Cannot read properties of null (reading 'path'):

  • [note 1](../../path/to/note%201.md#3)
  • [[note 1.md#3]]
  • [[note 1#3]]

all are heading links i.e. #3

2 Likes

Awesome bug report, thank you.

Those issues have been fixed, and I have great news!

The script will now remove any embedded fonts, and upload them as separate files which are then linked back into the theme CSS. I have tested this with Minimal at my end, which is now showing 690kb for the CSS.

  • If the file has already been shared, it won’t compute and upload the CSS.
  • If you want to force a re-upload of your CSS, just remove the share_link property from your frontmatter and share the file.

I have removed the previous UPLOAD_CSS config option. If you’re using my example PHP upload script, you will need to update the whitelist to allow for font files to be uploaded:

$whitelist = ['html', 'css', 'jpg', 'png', 'ttf', 'otf', 'woff', 'woff2'];

The format for embedding fonts is a bit variable, so I may need to add matching for additional cases in the future. Let me know if you come across any that don’t extract themselves.

1 Like

The requirements state, “If you don’t already have a web server, or you don’t know how to post JSON data to a server, you will definitely run into trouble.”

Newbie question: I have web server through Bluehost. I don’t know how to post data to the server. Am I posting it to a MySQL database?

  1. Create a new folder on your Bluehost server.

  2. Make a file called upload.php and copy my example PHP script into that file.

  3. Change the SECRET in both the PHP file and the Templater script.

  4. Upload the PHP file to your new folder on Bluehost.

  5. Point the Templater script config to the web location you uploaded the PHP file.

Bluehost uses PHP, so it should just work straight away.

1 Like

@hsarji I’ve added those instructions to the bottom of the documentation, so let me know if you get stuck anywhere or if I need to change anything in the docs:

Documentation

I’ve added a bit more instructions in the docs than what I posted in my last message.

v1.1.1 released:

  • Fixed issue where you couldn’t pull down to refresh the page on mobile
  • Added the normal Obsidian footer in. You can change the text to whatever you want, or turn it off from the config.

I’ve also put up some guides for various Obsidian functions here:

Obsidian guides

Free public hosting added

I just added free public hosting. This means you don’t need your own web hosting, you can immediately start sharing files.

Follow the Installation with Templater section in this setup guide.

Let me know if it works for you or what you think :slight_smile:

1 Like

So now, if I want to use the free option, every note that I want to publish will has the url as https://file.obsidianshare.com/numeric-id.html

How much does it cost you to open a free hosting for everyone like this?

Thanks for sharing.

If you use the private hosting it will also be in the same format of “numeric ID”. The only difference is the server the files are stored on.

The numeric ID is specifically like that to make the URLs impossible to guess.

Web hosting doesn’t cost much. I mentioned previously that you can get hosting for as cheap as $4 per year, so the cost is negligible.

1 Like

Awesome.

Is there any chance that you will develop a plugin to enhance the script?

Something like a modal inside Obsidian to make it easy to see which notes were published, has changed, or been unpublished :grin:

Sure, if there’s enough uptake to make it worthwhile creating a plugin. So far only a couple of people have used it.

If you end up trying it, let me know if it works or if you run into any issues.

1 Like

v1.1.5 released

I’ve added meta description and OG:description, so your shared links will now show a snippet preview of the note content when pasting into a platform that supports it, like this:

Thank you for sharing this! I finally made it work with HostDrive and DirectAdmin!

There is one thing that I did not figure out how to fix, though. For the links generated for me, it is in the format of https://obsidianshare.com/file/572e1ae4a0aeadf5943862d1deaf8fe6.html rathar than https://file.obsidianshare.com/572e1ae4a0aeadf5943862d1deaf8fe6.html. Still, I can access this file with both links.

I tried to create a subdomain and put everything within that directly, but it says that the file is not permitted to be accessed.

Also, is it possible to support deleting a shared note from within Obsidian?

If you’re using your own private server, the link will be generated based on the UPLOAD_LOCATION variable. Whatever you set this is what the final link will end up looking like.

Yes it’s very possible. That will probably be easiest to add if I end up turning it into a proper plugin, otherwise you’d need a second separate Templater script to perform the delete function.

Thanks! It works now. Previously I tried to upload to file.obsidianshare.com but the notes cannot be uploaded successfully, probably because I misconfigured something. After that, I deleted everything, including the domain.

Is it possible to provide such a Templater script for this purpose? I tried to find out how to modify the original script, but did not figure out how to do that.