Export-To-SSG Plugin

Hello Everyone, I have released export-to-ssg plugin.

This plugin allows you to export a set of notes under a notebook to a static site generator project. So now you can create content for your website as notes in notebook in joplin and then export it from here using this plugin to desired static site generator out of HUGO , GATSBY , JEKYLL.Please read it's README.md before using it -

example-1
example-2

#Everyone is contributor -

I have made UX and feature according to myself right now :upside_down_face:. It can create a great workflow for creating static sites as joplin is itself a powerful editor for creating notes in markdown.

Joplin[ Create content as notes ] -----Export-----> SSG Project ---------> Website

So it will be more better if user themselves provide suggestion for UX and feature how they want to leverage this plugin.

8 Likes

May I suggest to give it a proper name like Export to SSG? (You only have to change the name field in the manifest.json.)

The current name looks a bit weird (rather fitting for a script name):

Also, can you please add a homepage_url and a repository_url to the manifest.json?

1 Like

All d :upside_down_face: ne.

1 Like

Great, thanks. One small issue though. You also have to change the version in the manifest.json. Right now the git tag says 1.0.2 but the manifest says 1.0.0.

P.S.: Cool plugin!

1 Like

Thanks. Version is updated in manifest.json

For the future: This has to be done before you publish to npm. These 2 versions should match. So, if you publish version x.y.z to npm, you set version x.y.z in manifest.json, then in package.json and then you publish to npm.

Right now your plugin shows up as 1.0.0:

image

Okay, I will keep this in mind for the next time and I will match everything in the next patch. This was my first time releasing the npm package :sweat_smile: :sweat_smile:. But now I have read about semantic versioning from npm docs.

Now I have done this thing with v1.0.3 is it done now @tessus .

1 Like

Hello there,

great idea for a great plugin but ... I didn't manage to use it.

Every time I "Export to SSG" a Notebook (for Hugo) I can see that directories are created but no files in it ...
Could you tell me what I have to check in order to debug ? (I've tried from Joplin Desktop on Windows10 and Ubuntu 18.4).

Actually, I am also using Windows 10 and it is working fine for me.

So, now I think the problem we will need to tackle is related to how and what you are exporting. Now you can describe to me in a more clear manner the notebook whose notes you are exporting and how you are filling the form.

But first I will recommend you to go through this documentation here and read about the form fields of this plugin form, what is exported from this plugin, and about the level-1 depth. So that you can understand the problem more clearly and also describe to me in a better way what particular thing are you exactly facing.

Ok, here are the details of my test.

The exported notebook is named : Hugo
This notebook contains only one Level-1 note named : Test Plugin Export to SSG
The note contains the following text : Hello, this is a test for the "Export to SSG" plugin.

The export options are :
Choose your SSG : Hugo
Project Path : /home/philb/Documents/Hugo_site/ (this directory is empty)
Front Matter : empty

After exporting I obtain the following in /home/philb/Documents/Hugo_site/ :
philb@coltrane:~/Documents/Hugo_site$ ls -la
total 16
drwxrwxr-x 3 philb philb 4096 avril 21 08:46 content
drwxrwxr-x 3 philb philb 4096 avril 21 08:46 static

ls -la /home/philb/Documents/Hugo_site/content/
drwxrwxr-x 3 philb philb 4096 avril 21 08:46 .
drwxrwxr-x 4 philb philb 4096 avril 21 08:46 ..
drwxrwxr-x 2 philb philb 4096 avril 21 08:46 Hugo-d7c90d29cc9744ab98c598898f4665f4

ls -la /home/philb/Documents/Hugo_site/content/Hugo-d7c90d29cc9744ab98c598898f4665f4/
total 8
drwxrwxr-x 2 philb philb 4096 avril 21 08:46 .
drwxrwxr-x 3 philb philb 4096 avril 21 08:46 ..

philb@coltrane:~/Documents/Hugo_site$ ls -la /home/philb/Documents/Hugo_site/static/
total 12
drwxrwxr-x 3 philb philb 4096 avril 21 08:46 .
drwxrwxr-x 4 philb philb 4096 avril 21 08:46 ..
drwxrwxr-x 2 philb philb 4096 avril 21 08:46 resources

philb@coltrane:~/Documents/Hugo_site$ ls -la /home/philb/Documents/Hugo_site/static/resources/
total 8
drwxrwxr-x 2 philb philb 4096 avril 21 08:46 .
drwxrwxr-x 3 philb philb 4096 avril 21 08:46 ..

So, you can see that the directories are well created but there is no files in there ...

So, any idea ? Is there any log files I can check in order to understand the origin of this issue ?

Hello @Phil.B3, sorry for the late reply. Actually, I was testing my plugin on the Linux system as well, with the same things( notebook, note, folder ) as you have given above and on windows 10 I have tried earlier. And with the same commands, I have searched the files on the terminal as well. Everything worked well for me.

Now if you are worried about why the static/resources folder is empty. Then no need to worry as you have not attached any static file like an image, pdf to the above mentioned note. So it will be definitely empty.

Otherwise :sweat_smile:, it means that you will need to debug from your end where you are going wrong. Now, what are my suggestion for you -

  1. Firstly check out the joplin version as the min app version for this is '1.7'.
  2. It is a silly one but are you sure that notes are under the notebook that you are exporting.

Finally, a suggestion to debug is to contact your friend who is using the same OS as you. Then request him to install and use this plugin. If it works for him try to find out that difference where you went wrong. But if it didn't work for your friend as well then feel free to reply back here with your query :slight_smile:.

Hello,

after attaching an image to the note "Test Plugin Export to SSG"contained in the Hugo notebook

Hello, this is a test for the "Export to SSG" plugin.

joplin.png

and exporting via the plugin, I can see that there is no file into the static folder ...

I remind you, that I can reproduce the same issue on Win10 so it seems that the OS is not the problem ...

The Joplin (Desktop) version I use is : 1.7.11
and yes, of course, the "Test Plugin Export to SSG" note is under the "Hugo" notebook I have exported.

May be I can try to run Joplin with a kind of debug option in order to investigate but I don't know if such options is available and if your plugin can send debug information ...

May be the following can help ...

By activating this debug option : How to enable debugging | Joplin,
I've obtained the following information in the Joplin log file (after using the plugin) :

...
...
...
2021-04-23 12:08:49: "CommandService::execute:", "staticSiteExporterDialog", "["423f81363d2d4be890fe197159ac9e43"]"
2021-04-23 12:08:49: PluginRunner: "Got message (3): joplin.views.dialogs.open", "["plugin-view-com.export-to-ssg.aman-d-1-n-only-SSG-Dialog"]"
2021-04-23 12:08:51: UserWebview: "Got message", "setHtml", "{"hash":"724f8fe9953c25b3c5f83800863d444d","html":"\n\t\t<div class="dialog" >\n\t\t\t<div class="dialog-header">\n\t\t\t\t

Exporting Configuration

\n\t\t\t\n\t\t\t<div class="dialog-main">\n\t\t\t\t<form id="swg-form" name="basic_info">\n \t <div class="field">\n\t\t\t\t\t\t<p class="labels" >Choose your SSG (*required)

\n\t\t\t\t\t\t<label for="hugo">Hugo\n \t\t\t\t\t\t<input type="radio" id="hugo" name="ssg" value="hugo">
\n \t\t\t\t\t\t<label for="gatsby">Gatsby\n \t\t\t\t\t\t<input type="radio" id="gatsby" name="ssg" value="gatsby">
\n \t\t\t\t\t\t<label for="jekyll">Jekyll\n \t\t\t\t\t\t<input type="radio" id="jekyll" name="ssg" value="jekyll">
\n \t \n \t <div class="field">\n \t <label class="block-element labels" for="dest_Path"> Project Path (*required) \n\t\t\t\t\t <input class="block-element" id="dest_Path" type="text" name="dest_Path" required autocomplete placeholder="Paste the absolute path" /> \n \t \n \t <div class="field">\n\t\t\t\t\t <label class="block-element labels" for="frontMatter" >Front Matter (optional) \n\t\t\t\t\t <textarea placeholder="Type front matter here..." class="block-element" id = "frontMatter" rows = 10 cols="20" name="frontMatter">\n \t \n\t\t\t\t \n\t\t\t\n\t\t\n\t\t"}"
2021-04-23 12:08:51: UserWebview: "Got message", "setScripts", "{"scripts":["/home/philb/.config/joplin-desktop/cache/com.export-to-ssg.aman-d-1-n-only/form.css"]}"
2021-04-23 12:08:51: UserWebview: "Got message", "setScript", "{"script":"/home/philb/.config/joplin-desktop/tmp/plugin_com.export-to-ssg.aman-d-1-n-only_theme_2.css","key":"themeCss"}"
2021-04-23 12:09:14: PluginRunner: "Got message (3): joplin.commands.execute", "["exportingProcedure","423f81363d2d4be890fe197159ac9e43",{"basic_info":{"ssg":"hugo","dest_Path":"/home/philb/Documents/Hugo_site/","frontMatter":""}}]"
2021-04-23 12:09:14: "CommandService::execute:", "exportingProcedure", "["423f81363d2d4be890fe197159ac9e43",{"basic_info":{"ssg":"hugo","dest_Path":"/home/philb/Documents/Hugo_site/","frontMatter":""}}]"
2021-04-23 12:09:14: PluginRunner: "Got message (3): joplin.data.get", "[["folders","423f81363d2d4be890fe197159ac9e43"],{"fields":["id","title","body"]}]"
2021-04-23 12:09:14: PluginRunner: "Got message (3): joplin.data.get", "[["notes"],{"fields":["id","title","body","parent_id"]}]"

Hi, @Phil.B3 are these the complete logs? Because for the same action my logs are a little bit different at the end for the same thing and if you clear these are complete logs then we can move ahead with debugging?
LHS are my logs and on RHS are your logs.

Hi,

yes I confirm that this is the complete log and that I only see this last line :
2021-04-25 17:49:16: PluginRunner: "Got message (3): joplin.data.get", "[["notes"],{"fields":["id","title","body","parent_id"]}]"
and no line with the note ID ...

Very strange, isn't it ?

:sweat_smile: Actually problem is that it is running everywhere fine just having some problem with your system. And I don't have live access to your system and on my system error is not coming. So from my end, I can only speculate. Try to reinstall and use it again. After that try to use it in different situations and compare them like changing the notebook name, sub-note quantity. I think in this case effort from your end will help more.

This line is not running it feels like that specific part of code is missing on your end. So maybe reinstalling will help. Even though this line is not running yet your note should be exported because this part of the code is only responsible for exporting the static file.

I will hope that this plugin may come in handy to you. If it comes handy to you please give suggestion to make it better.