kirby3-janitor icon indicating copy to clipboard operation
kirby3-janitor copied to clipboard

Render job fails on local multilanguage site

Open ianisl opened this issue 1 year ago • 1 comments

I am using the CLI to render thumbs on my development machine (locally) via the render job. This worked fine in a single-language site, however after enabling multi-language setup the rendered job stop working (rendering failed error).

The problem seems caused by the default language code that is appended to the site's URL by Kirby in multilanguage mod (en in my case):

  • The current value of Janitor's renderSiteUrl option is set to return site()->url() when running in CLI mode. That would be http://localhost:8000 in my case.
  • If I set renderSiteUrl to return http://localhost:8000/en, the render job succeeds.

ianisl avatar Jul 29 '22 14:07 ianisl

site()->url() ends with the language code as far as i can tell (kirby 3.8.0) in both CLI and webserver.

what is different in my code if you set it explicitly it uses a Remote request instead of $page->render()/site()->visit()-combination.

my guess is that the cli does not have the right url because its not running on the webserver. it will just be /en.

to confirm try this:

janitor --tinker
echo site()->url();

should return /en.

to fix for the CLI use set the config value to this

'bnomei.janitor.renderSiteUrl' => fn() => '/', <-- set it to this, just `/`

bnomei avatar Oct 11 '22 17:10 bnomei