Opening question:
Regarding the performance of the homepage I’ve been taking a quick look. These are my suggestions:
Improve how you work with fonts
I can see once you load the home it makes a lot of calls to fonts.googleapis.com
, as you are loading a lot of fonts. You may want to select the formats you are using and self-host them in your project.
- Here you have a long article explaining the different options and why it’s important to self-host your fonts in terms of performance.
- You can check and example on the
twentytwenty-theme
- We store the fonts we want in a
fonts
folder -> https://github.com/frontity/frontity/tree/dev/packages/twentytwenty-theme/src/fonts - We define them inside the
styles
folder -> https://github.com/frontity/frontity/blob/dev/packages/twentytwenty-theme/src/components/styles/font-faces.js
- We store the fonts we want in a
- I think you can download all the fonts you are using from https://fonts.google.com/
Reduce the number of fetches
I’ve also seen that you are doing a lot of fetches. You may want to give it a thought and try to reduce them.
For example, I can see that you are doing one fetch for each folder
doing https://yoursite.com/wp-json/wp/v2/folder?slug=hir
, https://yoursite.com/wp-json/wp/v2/folder?slug=interju
… You could just fetch https://yoursite.com/wp-json/wp/v2/folder
and populate state.source.folder
with all of them (they are just 8 right now).
I can only see you are fetching many times your posts filtering by folder
: https://yoursite.com/wp-json/wp/v2/posts?_embed=true&folder=23&order=asc&orderby=menu_order&page=1
, https://yoursite.com/wp-json/wp/v2/posts?_embed=true&folder=24&order=asc&orderby=menu_order&page=1
… You could create a Custom Post Type to fetch all these posts, as we are doing with movies in our test. If you want to keep them inside posts
, you could do all the fetchs again in the same call, doing something like this: https://yoursite.com/wp-json/wp/v2/posts?_embed=true&folder=23,24,25,26...
,
Cache your API response
Not sure if you’re already doing this, but if not I’d recommend you to do so. We’re currently using this plugin and it works pretty well so far.
Use a CDN for your images
I think you’re already doing this, but if not you can use JetPack free CDN, which also converts them into webp
format, that is the next gen format recommended by Google.
Use LightHouse perfomance report
Apart from the things mentioned before, you may want to run a test of your site at https://web.dev/measure/ and follow the suggestions it gives you, they are usually quite interesting.