8132. Jekyll - Performance Optimization
Performance


Performance.

Why Use Cookie-Free Domains?

Although cookies are very useful in some cases, in other cases - such as the delivery of static content, they can hinder performance. When a browser makes a request for a static asset such as an image or CSS file, there is no need for it to also send a cookie to the server. This only creates additional network traffic and since the files are static (they do not change) the server has no use for the added cookie.

When you use cookie-free domains you are able to separate the content that doesn’t require cookies from the content that does. This helps improve your site’s performance by eliminating unneeded network traffic.

Testing

image

2. Cache Header

Create netlify.toml

[build]
  command = "jekyll build"
  publish = "_site/"

[[headers]]
  for = "/assets/images/*"
  [headers.values]
    Cache-Control = "public, s-max-age=604800"
[[headers]]
  for = "/assets/css/*.css"
  [headers.values]
    Cache-Control = "public, s-max-age=604800"
[[headers]]
  for = "/assets/js/*.js"
  [headers.values]
    Cache-Control = "public, s-max-age=604800"

3. Reference