-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added generate sitemap command + schedule option #2
Conversation
README.md
Outdated
## Sitemap Generation | ||
This package includes a configuration option to control the automatic scheduling of the sitemap generation command. | ||
|
||
In the package’s service provider, if `schedule_generate_command` is enabled, the command is scheduled: | ||
|
||
```php | ||
if (config('rapidez.sitemap.schedule_generate_command')) { | ||
Schedule::command('rapidez:sitemap:generate')->twiceDaily(0, 12); | ||
} | ||
``` | ||
|
||
To disable scheduling, set this in your .env: `RAPIDEZ_SITEMAP_SCHEDULE_GENERATE=false`. | ||
|
||
To run the sitemap generation manually, use: | ||
```bash | ||
php artisan rapidez:sitemap:generate | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure if we want this within the package. From rapidez/core
we're not registering any schedules, for example for the indexer: https://docs.rapidez.io/3.x/indexer.html#scheduler and that's moved with Laravel 11 to routes/console.php
or the bootstrap/app.php
, maybe we should provide some examples within rapidez/rapidez
which you can simply uncomment and change?
I'm afraid if we're going to register schedules from packages users aren't aware of them, there is a schedule:list
command but still; better to have them defined within your project in 1 place? And mention that in the configuration or deployment docs.
Thoughts @kevinmeijer97 / @indykoning / @BobWez98?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we're not doing it for other commands either, and you will always lack control by registering it automatically.
(Like, when do you want it executed? Do you want to run it in your own cronjob so you can separate command output?)
I agree it might be better to make users register it manually so they have maximum control.
That way they could even execute it on events and not based on cron at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, i removed the scheduling and added some info in the readme for this
With this approach the sitemap will be cleared with a cache clear; maybe better to actually generate the sitemap and get rid of the controller? |
I agree, this has now been changed to work as follows: |
Added the possibility to generate (or pre-cache) the sitemaps with the ability to also hook into the generation command by using an Eventy action.