I have updated Obsidian Mkdocs Publisher to make it more universal. In fact, today I’m introducing Obsidian GitHub Publisher.
This plugin is used to upload files to a configured GitHub repo. Unlike Obsidian Git, the plugin allows sharing only files marked by a pre-configured meta-data key, similar to publish: true
in Obsidian Publish.
The configuration of the plugin makes it possible to share files in any repo you own.
The final idea is to provide a plugin/workflow for the majority of alternatives to Obsidian Publish.
Thus, the plugin allows configuring different workflows:
- It is possible to push in a GitHub repo by setting a receiving folder ;
- But also to push in a folder respecting a hierarchy, either from Obsidian (relative path) or from a key configured in the frontmatter.
The idea is to be able to push in a specific place of your repository, to respect the constraints of mkdocs or Jekyll.
Moreover, you can choose to transfer (or not) the images, with the choice of a specific reception folder for it.
Finally, it is possible to configure the autodeletion of files that have been deleted or that you have stopped sharing.
Be careful though, the autodeletion is only possible if you have configured the reception folder (as well as the “Root” folder if you use the YAML frontmatter). Also, you can loose data!
Configuration
To use the plugin, you need to fill the correct information to allow the workflow.
1. GitHub
- Repo name: The repository where the information will be sent.
- GitHub username: Your username.
- GitHub Token: Get your GitHub Token here. The correct settings should already be applied. If you want to avoid generating this every few months, select the “No expiration” option. Click the “Generate token” button, and copy the token you are presented with on the next page.
2. Download configuration.
Folder reception settings.
You have two options :
- Use a “fixed” folder : Every file will be sent in this folder.
- Use a folder created based on a
category
key. - Use the relative path from obsidian. You can prepend a folder using the default folder.
You need, in all case, to configure the default folder : The file will be sent here.
If you use the option for frontmatter, this folder will be the default folder : the file will be sent here if the key doesn’t exist.
Metadata frontmatter
Using the second option will activate two more options :
- Front matter key: The key you want to use in your file.
- Root folder : To prepend a path before the category key found (if any key are found!)
Example
- You use
category
in a file withcategory: Roleplay/Characters/DND
- You set a root folder with
_docs/pages
- And you set a default folder on
_docs/draft
The final path (in GitHub!) will be :
_docs/pages/Roleplay/Characters/DND
But, if you don’t set
category
, the path will be_docs/draft
Fixed folder
Every file will be sent in the default folder. If you leave the default folder blank, it will be sent in the root of the repository.
Example
- If you set
source
for the default folder, any file will be sent inyour_repo/source
, whatever is their frontmatter key or their relative path.- If you leave it blank, it will be sent in
your_repo
directly.
Obsidian Path
It uses the relative path in your Obsidian vault. The default folder will be prepended before the relative obsidian path. You can leave it blank to use the root repository.
Example
For a file in20. Compendium/DND/Monster
- If you set
source
: the final path will besource/20. Compendium/DND/Monster
- If you leave the default folder blank, the final path will be
20. Compendium/DND/Monster
Workflow
If your workflow needs to activate a GitHub actions, set the name here.
Leave it blank to disable the GitHub actions activation.
You can also set up an “auto-delete” when you use the commands to delete files:
- Deleted from your vault
- Which you have stopped sharing
This option will also add a new command to delete file (without sharing new file).
Warning
You can’t use the delete command if you don’t have set a default folder (and a root folder if you use the YAML configuration)
Also, you can lost some files using this commands, so be careful! Don’t forget that you can revert commit in case the plugin delete a file you don’t want to delete.
Embedded file
Occasionally, you want to avoid sending the image linked (why? Don’t know. It’s your GitHub repo, after all!). You can remove the transfer of these files.
If you choose to send image, you can set a default folder for image.
3. Plugin settings
You can configure :
- The share key used by the plugin. By default, it is
share
- Folder excluded. The share key can’t work here. Useful if you forget to remove the
share
(or turn it tofalse
) and move a file in your archive… - Add the command to share the file on the file menu (right-click on a file in the explorer or using the three dot) and editor menu (right-click on an opened edited note)
In the Readme, you can see some workflow example.