# Micropub

Micropub is a community maintained plugin for [Obsidian](https://obsidian.md/) to publish notes your own site with [Micropub](https://indieweb.org/Micropub).

## Credits

- Forked from https://github.com/otaviocc/obsidian-microblog, this was used as the base, since Micro.blog also uses the Micropub standard under the hood
- With code from https://github.com/lijyze/obsidian-state-switcher, to manipulate the yaml frontmatter of notes

## Donating

Does this plugin improve your workflow? Say thanks with a coffee to the [original author](https://github.com/otaviocc).

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Z8Z0C9KPT)

## Status

This plugin is considered alpha software. Even though the publish workflow lets you publish notes, there are a lot of things that are not implemented, most notably:

- **Proper [RelMeAuth Flow](https://indieweb.org/RelMeAuth)**, for now you need to generate a static token that is validated by the Micropub endpoint and save that token in the settings of the plugin.
- **Updating posts**, once you have published at note, it is not possible to publish it again, making use of the [Micropub update action](https://www.w3.org/TR/micropub/#h-update).
- **Writing back tags, publish date, etc. to the frontmatter**, as this requires a `q=source` call to the micropub endpoint which is missing at the moment.
- **More configuration options**, for setting the names of targeted frontmatter fields, or for toggling on and of optional features like fetching tags, etc.

## Micropub Details

This plugin makes use of a few micropub features, including a few non-standard extensions

- `mp-destination` for potentially selecting a publishing destination. (https://indieweb.org/Micropub-extensions#Destination)
- `q=category` for receiving a list of existing tags/categories from the server (https://indieweb.org/Micropub-extensions#Query_for_Category/Tag_List)
- `q=config` for receiving a list of publishing channels on a site (https://github.com/indieweb/micropub-extensions/issues/40)
- `q=source` for checking for existing posts before attempting to update them (https://www.w3.org/TR/micropub/#configuration)


## Installing

This plugin will be available via *Community Plugins* soon.

## Screenshots

### Preferences

From the preferences window it is possible to log in using Micropub.

![](images/01-preferences.png)

Once logged in, the plugin allows to set default values for tags, post visibility, and default blog (in case the user has more than one hosted blog). These default values will be used when posting to your site.

![](images/02-preferences.png)

### Command

Micropub is triggered using Obsidian's command palette.

![](images/03-command.png)

### Publish

Before publishing, it's possible to edit the title, override default values, and/or select a different blog to post to.

![](images/04-review.png)

After publishing, a confirmation window with the post links is presented.

![](images/05-confirmation.png)

## Building from source

Clone this repository inside the Obsidian Vault:

```
$ cd .obsidian/plugins/
$ git clone https://git.inhji.de/inhji/obsidian-micropub
```

Resolve the plugin dependencies and build it:

```
$ cd obsidian-micropub
$ npm i
$ npm run build
```

Restart Obsidian and enable the plugin from *Community Plugins* in Preferences.

## 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

## Disclaimer

This project is neither affiliated with Obsidian. This is a community maintained plugin.
