Publishing Joplin notes as Hugo posts.

Publishing Joplin notes as Hugo posts

Screenshot from 2024-12-13 23-08-22.png

At first I was thinking that the only way to write and publish articles to Medium would be via usage of blogging platforms or solutions like Hugo static site generators, but since I am years hooked on Joplin app I was wandering weather there wouldn’t be some way to publish directly from Joplin to GitHub and then perhaps somehow via actions to Medium. It seems to be pretty solid solution since there is this plugin developed by RXliuli user and it is decent for the use case. I only need to find an action which would be using any existent medium api for publishing.

There was one action I have found for the previous idea where I was considering Hugo to be my blog content platform and someone had written long time ago an action for publishing Hugo to Medium https://github.com/pr4k/hugo-to-medium. But as I was researching the used Medium Python module it is no longer maintained and I am bit suspicious that Medium is not having any decent API access. Here the Unoficial Medium API article explains quite well the situation, but it is really just dedicated to getting data from Medium and not to post anything to it. Here I found also an article about the REST api pythonic way for posting content to Medium. https://dev.to/luca1iu/how-to-publish-an-article-to-medium-using-python-and-the-medium-api-50g2#:~:text=Publishing%20an%20Article&text=The%20process%20involves%20sending%20a,article%20content%20and%20some%20metadata.&text=Now%20you%20can%20head%20over,ahead%20and%20publish%20it%20directly!

continuation day 02

So after todays research I had figured out following:

continuation day 03

  • Hugo site finally created
  • found pretty decent Theme. Hugo-winston-theme.
  • some changes had been done on the theme so it is titting more my style.

continuation day 04

continuation day 04

  • Yeeeess it works! I have managed to enhance the Joplin Publisher plugin the way it is now publishing to my web.
  • Now I need to figure out how to pull request back to the upstream and build the joplin plugin for myself untill it will be merged and released.
  • also I will need to figure out how to batch commit each individual file and so the medium publisher could evaluate individual files.

continuation day 05

  • I was wondering whether I should also include some template for Medium posts which would be probably added somewhere at bottom and calling readers for liking/clapping and following me or even including link to the original post at my site.
  • Perhaps best way would be to inlude `published tag into joplin posts so they are not always republished any time I hit publish.
  • So I had tested the individual markdown file push and figured out even the way the asynchronous raise condition is not happening but then the workfow operating on Push trigger is failing to process 3 events submitted rapidly after each other. So I was researching a little and figured out that best approach would be to have only one push but then let workflow to iterate those commits related to the push. https://stackoverflow.com/questions/64708371/how-to-run-github-workflow-on-every-commit-of-a-push
  • I need to test inter document linking. It might not work but it will for sure be important.

continuation day 06

Multi commit per file

For couple hours I was trying to alter the Joplin-publisher plugin to create commit for every single ‘blog’ labeled MD file. I am running into limits of my JS knowledge and also the time I had assigned myself for the task. So I had figured out that the only reason I had originally had for the task - to be able to capture the file name which needs to be published at Medium or Linked in - has to find different approach. I had changed my strategy to rather let the GH action detect the changed files in latest Push and then iterate a procedure on each of them.

I will alter the plugin minimally which is also quite practical, since there might be also smaller chance for any repo owner pushback. Remember that the power of quick closures on PRs is in smallest chunks as possible and minimalistic approach.

I will try following action for code changes https://stackoverflow.com/a/71070817/27643892

Projects pages

For future I will need to figure out also Projects pages which will need to be structured little bit differently. Each project will need to have own folder with multiple files in each. This will need to be reflected in own project page related left side menu. This will be listing all projects by the folder name. Then on right side there will need to be another menu listing all individual files and perhaps even subitems of each nested H# texts. But lets not get too complex for one.

I was studying today Hugo partials and layouts and also looked into hugo-whisper-theme for its application of Docs section. Here I could partly see solution for folder based menu.

continuation day 07

Not sure why but suddenly the Publishing plugin is not commiting anymore. There is currently no way for me to push into the main branch any commit. I had spent around 2 hours to debug and fix but unfortunately I am not able to find the cause of the issue. Since it is JS it is even more difficult. New plan is to reverse all changes and add new pieces one by one.

continuation day 08

So today at morning I had finally realized there might be something fundamentally wrong with the way I am developing within the joplin-utils mono repo. After an hour of research I had figured out that the package.json mentioning for dev dependencies which are not having defined nodes versions but unstead they are using workspace:^ that there might be something to look into. Since PNPM was already on my computer I had jumped into the root folder of the repository and found pnpm-workspase.yaml from here I was researching the way how to use it. So then just by simply pnpm install had installed all linked packages in folder and then pnpm setup-all had builded and prepared all important package dist folders so I could just simply jump a particular package root - in my case joplin-publish and start dev mode by pnpm dev and all was working finally as expected. This way of development is really awesome and I am quite sorry that Python is not offering similar way of development. Dev more in the joplin-utils is having watch folder mode since it is using its own proprietary jpl cli utility.

So I have managed to connect two workspaces together, just wanted to test this concept. joplin-utils is very heavily dependent on mark-magic monorepo. Most of low level functionalities are taken from there. I wanted to discover the interconected workspaces approach and all was working pretty well. Later at the day I had realized that I do not need to develop anything in mark-magic so this was just a part of research.

continuation day 09

All I needed to develop for joplin-utils have been done. PR is submitted to the upstream repository. Now I can just build my own package and continue with next steps. Important will be to create the GH workflow for publishing posts to Medium and then to LinkedIn.

Great news! My PR was merged and new version was released. Yes I know that it was just a PR but this PR was done in TypeScript and it was my first development in this language! 🥳