Mkdocs-material: Great Layout and functionality but real bad pagespeed rating

Created on 1 Mar 2018  路  4Comments  路  Source: squidfunk/mkdocs-material

Description

Coming from HUGO I stumbled over the real impressive mkdocs-material.
Before switching over to the mkdocs world I made a quick pagespeed test (see blow) and was a bit dissapointed by the figures (73 mobile, 46 desktop).

Expected behavior

Clients nowadays demand loading times of less than 3 seconds with a pagespeed rating of at least 85.

Actual behavior

PageSpeed Insights

Question

Can "mkdocs-material" be improved with respect to render-blocking?

proposal

All 4 comments

Thanks for reporting. I did a pagespeed test some while ago and it had the same result. I try to explain the penalties:

  • Eliminate render-blocking JavaScript and CSS in above-the-fold content: for JavaScript this could theoretically be omitted by moving modernizr.js to the bottom of the body right above the application.js . It's possible as Material is entirely built using progressive enhancement, but I don't know if it will greatly improve rendering. Extracting the above-the-fold CSS is not really possible, as "above the fold" can be the entire page, see:

bildschirmfoto 2018-03-01 um 18 59 33

  • Leverage browser caching: this is entirely attributed to the cache headers of GitHub pages. The theme can't do anything about these values. If you self-host, you can eliminate all errors by setting more appropriate cache headers.

  • Optimize images: that's a problem specific to the Material documentation and the large image. I may consider generating a thumbnail for this, but it's not a problem of the theme but of the content.

Same for desktop and mobile. For validation, I searched for people self-hosting their docs and found retropie.org.uk to have quite a reasonable configuration:

bildschirmfoto 2018-03-01 um 19 14 40

See the page speed insights. If they would optimize asset delivery, page speed ratings should be above 85 for both mobile and desktop.

Oh, and the load times are also very good (in my opinion):

| Request | Payload | DomContentLoaded | Load |
| - | - | - | - |
| 1st | 219 KB | 535 ms | 809 ms |
| 2nd | < 1 KB | 384 ms | 459 ms |

Measured on https://squidfunk.github.io/mkdocs-material/getting-started/

Closing this as answered/resolved.

@dbdevtop I'm not a fan of this solution but you may look at this article:

https://varvy.com/pagespeed/defer-loading-javascript.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

40huo picture 40huo  路  3Comments

danierutu picture danierutu  路  3Comments

madrus picture madrus  路  3Comments

LinusGeffarth picture LinusGeffarth  路  3Comments

Timber232 picture Timber232  路  3Comments