omz13 / kirby3-xmlsitemap

kirby3 plugin to generate an xml-based sitemap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with custom folder setup?

macx opened this issue · comments

I installed this plugin with composer, but it's not working at all. Open /sitemap.xml will result into a 404. I'm using a custom folder setup. Could that be the problem?

<?php

$base = dirname(__DIR__);

require $base . '/vendor/autoload.php';

$kirby = new Kirby([
  'roots' => [
    'index'    => __DIR__,
    'base'     => $base,
    'content'  => $base . '/dist/content',
    'site'     => $src = $base . '/src',
    'storage'  => $storage = $src . '/storage',
    'accounts' => $storage . '/accounts',
    'cache'    => $storage . '/cache',
    'sessions' => $storage . '/sessions'
  ]
]);

echo $kirby->render();

You are redefining roots/site ... you need to define extra:kirby-plugin-path in your composer.json so plugins are installed in this non-standard place as detailed here.

@omz13 This plugin only works, if it is in site (or in my case src thanks to your hint). But: All other plugins I've installed and used worked nicely in the vendor folder. Maybe you could config your plugin less restrict?

@macx My plugin has no such restrictions. I tried it on my test system with a non-standard 'site' and everything is good. After changing your config.json you need to composer dumpautoload to ensure the autoloader is updated. Also, the plugin (and any that are of composer type kirby-plugin) doesn't really work from vendor because the composer-installer for type kirby-plugin copies the plugin from vendor into site/plugins (or whatever is configured)... this is probably why you were having the original problem (you had moved site but the installer did not know about it). Having a non-standard location for 'site' is something you might want to reconsider.