Comments (8)
Yes that seems to work 🎉
My file now:
export default {
/**
* An asynchronous register function that runs before
* your application is initialized.
*
* This gives you an opportunity to extend code.
*/
register(/*{ strapi }*/) {},
/**
* An asynchronous bootstrap function that runs before
* your application gets started.
*
* This gives you an opportunity to set up your data model,
* run jobs, or perform some special logic.
*/
async bootstrap({ strapi }) {
await strapi.plugin('sitemap').service('core').createSitemap();
},
};
from strapi-plugin-sitemap.
Hmmm, interesting feature request.
You could actually do this yourself aswell.
Just put this code in your bootstrap function:
strapi.plugin('sitemap').service('core').createSitemap();
from strapi-plugin-sitemap.
Aah, I did not know that, created an API now that generates it if the file does not exist.
Is there any docs available about adding to bootstrap? I searched for it but could not find anything, that's why I created the API.
from strapi-plugin-sitemap.
EDIT: OK apparently there is no real documentation about this, but you can see here that the bootstrap function can be called from the src/admin/app.js
file: https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#locales
from strapi-plugin-sitemap.
Thanks! Then this ticket can be closed as this would do exactly what I need.
from strapi-plugin-sitemap.
Great :)
Do let me know if it works out for you.
If not I might add this as a feature
from strapi-plugin-sitemap.
Currently have this:
export default {
config: {
locales: []
},
async bootstrap({ strapi }) {
await strapi.plugin('sitemap').service('core').createSitemap()
}
}
But it does not work, I think this is because it's ran on the client side when going to the admin panel.
from strapi-plugin-sitemap.
You are right. Pardon me. My bad. There is documentation about the server bootstrap phase.
Right here: https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/optional/functions.html#bootstrap
from strapi-plugin-sitemap.
Related Issues (20)
- Update dependencies to mitigate vulnerabilities HOT 1
- Not working with strapi 4.11.5 HOT 2
- Support excluding sites by condition HOT 2
- how to exclude a specific url for sitemap HOT 9
- Allow URL translation sets for custom URLs HOT 2
- How to combine multiple content-types? HOT 2
- Server.js configuration for the sitemap plugin HOT 12
- Error when generating sitemap on Strapi 4.14.4 and Node v18 HOT 2
- Multiple hostnames/host profiles HOT 1
- Critical dependency: the request of a dependency is an expression HOT 5
- Allow relational fields be declared in url patern recursively HOT 3
- Bug: excludedTypes config setting doesn't seem to work HOT 5
- Bug: missing settings labels HOT 5
- Make the <xhtml:link> element in XML optional HOT 1
- feature request: pretty print option HOT 6
- Feature Request: i18n `prefix_except_default` strategy HOT 8
- Sitemap Breaks When Exceeding Limit and Strapi Port Differs from Default HOT 4
- Add an additional link tag with hreflang x-default to improve locale detection fallback HOT 5
- Does not work with ADMIN_PATH and STRAPI_ADMIN_BACKEND_URL HOT 1
- Add extension points / hooks. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strapi-plugin-sitemap.