Skip to content

otaviocc/obsidian-microblog

Repository files navigation

Micro.publish

GitHub Release (Latest) GitHub Releases Downloads

Micro.publish is a community-maintained plugin for Obsidian that allows you to publish notes to a Micro.blog blog.

Does this plugin improve your workflow? If so, you can show your appreciation by buying me a coffee.

ko-fi

This community-maintained plugin is not affiliated with Micro.blog or Obsidian.

Installation

To install this plugin, open Obsidian and go to Settings > Community Plugins > Browse. Search for Micro.publish and click Install. Alternately, it can be installed directly from Obsidian's website.

Screenshot 2023-08-31 at 06 28 51

Login

After installation, you need to log in to a Micro.blog account with an App Token. You can create an App Token on the Micro.blog Account Page.

Screenshot 2023-08-31 at 06 28 29

Settings

Users with multiple blogs can set a default blog, default categories, and default post visibility (draft or public). These settings can be overridden before publishing a note to Micro.blog.

Screenshot 2023-08-31 at 06 28 20

Publishing

The plugin has two commands that can be accessed through the Command Palette:

  • Post to Micro.blog - This command publishes the selected note to Micro.blog.
  • Synchronize Categories - This command fetches all the categories used in your blog from Micro.blog.

Screenshot 2023-08-31 at 06 33 49

Tip: Micro.publish automatically fetches categories from Micro.blog whenever Obsidian is launched.

Before publishing a note to Micro.blog, Micro.publish opens a window that allows you to change the post title, tags, visibility, and data (for scheduling a post for a future date).

Screenshot 2023-08-31 at 06 28 08

Properties

Micro.publish supports YAML frontmatter. It also works with the new Properties feature introduced in Obsidian 1.4, which is essentially a user-friendly interface for the less aesthetically pleasing YAML syntax.

  • Micro.publish will use the title property in the frontmatter or Properties, if it exists. Otherwise, it will fall back to the filename.
  • Micro.publish will use the tags property in the frontmatter or Properties, if it exists. Otherwise, it will use the default categories configured in Micro.publish's preferences.

Screenshot 2023-08-31 at 06 27 13

Screenshot 2023-08-31 at 06 27 36

Editing

For posts published with version 2.0.0 or newer, the post's URL will be added to the Markdown file in the YAML frontmatter/Property.

For those in Edit mode, it appears as a Property as shown below:

68747470733a2f2f6f746176696f2e63632f75706c6f6164732f323032332f70726f706572746965732e706e67-1

And for those utilizing the Source mode, as YAML:

68747470733a2f2f6f746176696f2e63632f75706c6f6164732f323032332f66726f6e746d61747465722e706e67

Once the note or title has been edited (either through the filename or YAML/Property), updating is as simple as using the Post to Micro.blog command from the Command Palette. A simplified version of the Review view will appear, displaying the post's title. For users with multiple blogs, it will prompt them to confirm which blog the post belongs to.

68747470733a2f2f6f746176696f2e63632f75706c6f6164732f323032332f726576696577656469742e706e67

It is also possible to update posts that were published using Micro.publish versions prior to 2.0.0. To do so, you must include a Property (or field in the YAML frontmatter) named url containing the URL of the published post, as illustrated below.

To include a new Property, simply follow these steps in the Command Palette:

68747470733a2f2f6f746176696f2e63632f75706c6f6164732f323032332f6164642d70726f70657274792e706e67

And add the url with the published post URL:

68747470733a2f2f6f746176696f2e63632f75706c6f6164732f323032332f70726f706572746965732e706e67-1

Those who prefer the YAML file can add the the url using the format:

---
url: https://example.com/path/to/post.html
---

After editing the note or title (either through the filename or YAML/Property), updating is as straightforward as utilizing the Post to Micro.blog command from the Command Palette. Similar to the process for version 2.0.0, a simplified version of the Review view will be presented, featuring the post's title. For users with multiple blogs, it will inquire about the blog to which the post should be associated.

Building from source

Clone this repository inside the Obsidian Vault:

$ cd .obsidian/plugins/
$ git clone https://github.com/otaviocc/obsidian-microblog

Resolve the plugin dependencies and build it:

$ cd obsidian-microblog
$ npm i
$ npm run build

Restart Obsidian and enable the plugin from Community Plugins in Settings.

Contributing

  1. Fork this repository and follow the steps from the previous section using the forked repository instead
  2. Create a feature branch for the changes
  3. Commit the changes and push them to the forked repository
  4. Submit a pull request