How to add custom front matter content and append it to the end after exporting?

As a Hexo blog user, I have front matter at the beginning of my blog posts. And I want to upload my notes to my blog. Currently, Joplin exports lack front matter. So, would it be possible to add front matter before exporting and have it appear as an append or addition to the preamble of the exported Markdown file?

Like shown in the image below.
1.This is the front matter content I want to display in the article.

2.and export it with front matter. The first image below is the original export, and the second one is what I want it to look like.


How can I implement such functionality? Or perhaps it already exists, and I just haven't discovered it.

I think this has been brought up a couple of times before but I don't think there has been any action taken on it.

See: Ability to add arbitrary properties to Note Properties, and hence Markdown frontmatter and Feature request/discussion: Custom API metadata.

The Plugin API supports extra field storage but I don't think these are currently used by the frontmatter importer/exporter.

thank you. I have read them all.
And I think, could it be reversed? I can write my necessary front matter all by myself without help of software before exporting. Instead of having the software write attributes into the front matter when selecting to export, why not have the software recognize the tags and title name within the existing front matter? I believe recognizing and displaying title and tags in their respective positions would be sufficient. However, this might significantly change the writing habits of those who don't use front matter, so differentiation based on whether front matter is used could be considered.

Perhaps, after creating a new article, we could have the option to choose whether to add a front matter template at the beginning or manually write the front matter. Adding a button to facilitate the customization of front matter templates could be a solution.

like the picture below.


This way, there's no need to use the first line as the file name, and there's no need to append properties during export. Everything is written in the front matter beforehand.And what the software should do is recognizing.All works are completed before the export; all I need to do is write the content for the front matter myself.

Lastly,when we export them, we don't choose export .md file with front matter.
I don't know if I expressed it clearly.

If it can be implemented, that would be great. If not, I'm willing to adapt to the existing writing method and manually add the necessary front matter in exported files. It's not difficult but quite cumbersome. In Fact, the core issue is to ensure that the content of blog articles and those in Joplin is consistent.

Actually, I think writing article elements in the front matter, such as time and categories, is more beneficial for browsing.

This should be implemented as a plugin rather than a core feature of the software; it seems not everyone may want to edit in this way.Embarrassing:| .

2 Likes

@MaxElectric The mark-magic I'm currently developing can do this, refer to the documentation: Mark-magic: Post joplin notes to blog

I tried using your plugin, but it threw an error.


It seems like an issue with my Joplin that caused the error in your plugin.

My version is Joplin 2.13.9 (prod, win32)
"I found that it deleted the _post I originally wrote. It scared me to death. Luckily, this is a copied version. :melting_face:
By the way, your plugin is great. :grinning:

Can you check if the web clipper service is enabled? access http://localhost:41184/folders?as_tree=1&token=your token

ref: Joplin Web Clipper | Joplin

Yes,the service is working.
I don’t add my token to url. My fault


Maybe my config is wrong. I'll study it again and figure it out.

What is the version of node? Please use node -v to check.

v18.15.0

Well, wait a minute, I'm using node 20, I'm going to test 18.


It is confirmed that nodejs 18 has the same problem. The behavior of fetch is inconsistent with that of nodejs 20. I will investigate it later. Are you willing to upgrade to nodejs 20 lts and give it a try? @MaxElectric

Sure.I am upgrading it . the errors disappear. but nothing exports to the source/_post.Should I add tag "blog" to my note first?

Sure.I am upgrading it . the errors disappear. but nothing exports to the source/_post.

Visit the link below to test whether the blog tag has any notes, or set tag: '' to export all notes to confirm.

http://localhost:41184/search?query=tag:blog&token=<your token>


Should I add tag "blog" to my note first?

Yes, to avoid posting any notes you don't want posted, all notes that need to be posted must be tagged with a certain tag.

thanks.It works :smiling_face_with_three_hearts:

1 Like

Thanks for the use and feedback, I will improve the documentation of joplin => hexo later, and maybe there will be a youtube video tutorial later.