Plugin: Generate static blog website and publish to Github Pages

I love the idea of this plugin, and would love for it to work for me, but I keep getting the error message:
Github Repository https://github.com/myusername/presentations doesn't exist. Do you want to create it on Github?
It does, and it doesn't get "recreated" if I choose that option.
Maybe it's a Windows git problem (I'm using Windows 10)? Git is installed, and the public_repo git token generated and copied to the plugin configuration.

I found it 404 when I tried to visit your repo. Is it deleted or a private repo? If it's a private repo, you should provide a token with private repo accessing privilege. FYI: a private repo can not be served as a website by github unless you are a paid user.

I'm pretty sure it is a public repo. I must say I am mostly ignorant about github, so I don't know what "blob" means, for instance. However, that is the whole point of the plugin, ain't it? Not that I am complaining, obviously, I am mainly grateful but stumped.

Can you access this? presentations/example.md at main · emilioluque/presentations · GitHub

I see. You provided wrong username of github to this plugin. Your Github username should be emilioluque , not myusername

FYI: If your repo name is presentation(instead of emilioluque.github.io), you need to do some extra configuration in Github to make your site accessible on Web. I'll make it automatic in next release.

Yes, sorry. I meant it to be generic.

I am tantalisingly close. I have tried to send a link, but Discourse disallows it. You can access my emilioluque presentations GitHub public repository, perhaps?

I have activated pages, but the notes I select to be published as articles do not seem to get published... but they seem to be in the right place, aren't they?

Your site is accesible in Emilio Luque now. But I found that this plugin doesn't work well if your domain is not https://emilioluque.github.io/. It's a bug, will be fixed in next release.

If you don't mind, you can create a repo named emilioluque.github.io to make everything work.

I think that repo is generated when GitHub Pages is activated. I can see it exists, but without any notes being published as articles. If you please check again, you'll see everything is there... except the notes-as-articles.

I saw you just created a repo emilioluque/emilioluque.github.io · GitHub .It's correct, but empty. You need to generate and publish again, to this right repo.

Hey, this seems like a great plugin. Definitely seems like the the most convenient way to export a bunch of stuff as an interlinked whole.

Is there any way to get it to publish a whole notebook?

I think this plugin doesn't support notebook-level publishing. @B0BIC

Can I make a feature request?

A lot of themes you can pick from make use of a YAML block at the start of the article to specify bits of the theme, would it be possible to process a YAML block and inject that data in as part of the ejs environment variables?

That way if people want to include features like pinning articles or having banner images per article they can specify and implement all that themselves in their own themes. Would be a really nice sort of "here, you can do anything with this if you have the know how" feature!

@Imperial_Squid Would it be better when theme-custom-fields appear on here:

Or just put them as YAML frontmatters?

There are disadvantages and advantages to both I guess, if it were done in that section your note would look a bit neater but I think it would also remove a bit of the link between a note and it's front matter. Putting it in the note itself makes it more clear what attributes you're tying to the note are but it's a bit less clean looking...

Would a middle ground be possible where if there is a front matter it gets extracted out and put in that section but if not then users can specify it when adding the article like you suggest?

@Imperial_Squid frontmatters will be article.meta since version 1.6.0

1 Like

Incredible! Thank you! :grin:

Just to check, will the front matter be processed when it gets injected or will it just be a block of text?

ie does a front matter like this
---
pin: true
project: Proj1
---

become separate like this:
article.meta.pin = True
article.meta.projecr = "Proj1*

Or is it all in one:
article.meta = "pin:true
project: Proj1"

Hi there @ylc395

First of all just wanted to thank you for the awesome plugin. I've been working in web design for over 15 years and moved from evernote to joplin, and haven't looked back. One of my biggest issues is recommending website platforms for my friends, as I typically use Wordpress. This system is too much for the simple sites my friends want, and I think this plugin is a good alternative. I have been working on a custom template for this plugin, but I seem to have run into an issue:

After extensive testing and reviewing the PageRenderer.ts code in the Joplin Page Publisher plugin, it seems that the _assets folder from the theme directory is not being copied over to the output directory as it should. This issue seems to stem from how the copyAssets() method is implemented.

Here's the critical part of the code:

```javascript
private async copyAssets() {
  if (!this.site || !this.themeDir || !this.outputDir || !this.outputAssetsDir) {
    throw new Error('pageRenderer is not initialized');
  }

  const { outputAssetsDir } = this;

  await fs.copy(this.themeDir, this.outputDir, {
    filter: (src, dest) =>
      dest === this.outputDir ||
      dest.startsWith(outputAssetsDir) ||
      (src.endsWith('.json') && !src.endsWith('config.json')),
  });
}

The current filter logic in the copyAssets() method does not account for the fact that the paths for the theme's _assets directory and the output _assets directory are fundamentally different. This results in the _assets folder not being copied as expected from the theme/templates/_assets directory or theme/_assets over to the plugin/output directory.

Tested:
Theme _assets Path: ylc395.pagesPublisher/themes/themename/_assets
Theme _assets Path: ylc395.pagesPublisher/themes/themename/template/_assets
Output _assets Path: ylc395.pagesPublisher/output/_assets

Given these distinct paths, the plugin's logic does not align the theme's _assets directory with the output directory's _assets folder. I notice as well that the _blocks folder does not get copied either.

To resolve this issue, a modification to the copyAssets() method is necessary. I believe we need to explicitly include a step to copy the contents of the theme's _assets directory to the output directory's _assets folder. This adjustment ensures that the intended assets are correctly included in the final output.

  1. For those facing this issue, a temporary workaround is to open Joplin, then Page Publisher, and then hit Generate. That will generate your site html.
  2. From there place your _assets directory in the output directory: /ylc395.pagesPublisher/output/_assets .
  3. From there hit the publish button in Page Publisher. That then uploads your _assets to github. If you referenced it in your EJS files it will resolve correctly.

Obviously this makes it hard to build and distribute a custom theme.

I am attempting to fix the issue, but my strength is more php than javascript, so it is slow going. If I manage to fix the issue, I'll submit a PR to the github repo.

1 Like