Open dancat93 opened 3 years ago
Hello from 2022! Answering because we had similar issues... and posterity.
It seemsjekyll-strapi
in it's current state will dispatch a request to your Strapi instance ("Jekyll Strapi: Fetching entries from...") for each reference to strapi.collections.*
in your template(s). This can cause an exponential amount of requests being dispatched based on your usage.
We're using the following workaround (with Strapi@4, but should work for Strapi@3 as well):
jekyll-strapi
to request content-types that you need pages generated for.Example Configuration
# @see https://github.com/brockfanning/jekyll-get-json
jekyll_get_json:
- data: articles
json: http://localhost:1337/api/articles?_limit=10000
strapi:
endpoint: http://localhost:1337/api
collections:
articles:
type: articles
permalink: articles/:slug
layout: article.html
output: true
With this configuration, strapi.collections.articles === site.data.articles
, using site.data.articles
in templates will avoid multiple request overhead. It's a bit more configuration, and I'm sure a patch to this plugin would be an improvement... but "it works" – 😅!
Is this for Strapi 3?
Hi everyone! When I run Jekyll application, initially I see that the plugin fetch the content inside each collections declared inside file _config.yml. So I see this in my terminal:
Jekyll Strapi: Fetching entries from xxx/articles?_locale=it&_limit=10000 Jekyll Strapi: Fetching entries from xxx/articles?_locale=en&_limit=10000 Jekyll Strapi: Fetching entries from xxx/business-areas?_locale=it&_limit=10000 Jekyll Strapi: Fetching entries from xxx/business-areas?_locale=en&_limit=10000 Jekyll Strapi: Fetching entries from xxx/categories?_locale=en&_limit=10000 Jekyll Strapi: Fetching entries from xxx/categories?_locale=en&_limit=10000
Where xxx is the name of my API endpoint. And so far everything is ok. After that, I see a message like “Jekyll Feed: Generating feed for posts” and the terminal start with a numerous API’s calls, about 20/30 for each collections.
This process really slow down the run of the application. And now, every run take about 60-70 sec and it’s too slow if we compared it with a simple Jekyll project that take about 4-5 sec.
There’s a way to speed up the run of application or to fix this numerous API’s calls?