GithubHelp home page GithubHelp logo

classicvalues / eleventy-high-performance-blog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google/eleventy-high-performance-blog

1.0 1.0 0.0 25.91 MB

A high performance blog template for the 11ty static site generator.

Home Page: https://www.industrialempathy.com/posts/eleventy-high-performance-blog/

License: MIT License

Shell 0.12% JavaScript 66.66% CSS 21.17% Nunjucks 12.05%

eleventy-high-performance-blog's Introduction

eleventy-high-performance-blog

A starter repository for building a blog with the Eleventy static site generator implementing a wide range of performance best practices.

Screenshot showing that the site achieves 100 points on Lighthouse by default

Based on the awesome eleventy-base-blog.

Demo

Getting Started

1. Generate a new repository from this repository template

Click the "Use this template" button. Alternatively you can clone this repo yourself and push your copy to your favorite git repository.

2. Clone your new repository

git clone https://github.com/YOUR_REPO

3. Navigate to the directory

cd my-blog-name

4. Install dependencies

npm install

5. Build, serve, watch and test

npm run watch

6. Build and test

npm run build

Customize

  • Search for "Update me" across files in your editor to find all the site specific things you should update.
  • Update the favicons in 'img/favicon/'.
  • Otherwise: Knock yourself out. This is a template repository.
  • For a simple color override, adjust these CSS variables at the top of css/main.css.
:root {
  --primary: #e7bf60;
  --primary-dark: #f9c412;
}

Features

Performance outcomes

Performance optimizations

Images

  • Generates multiple sizes of each image and uses them in srcset.
  • Generates a blurry placeholder for each image (without adding an HTML element or using JS).
  • Transcodes images to AVIF and webp and generates picture element.
  • Transcodes GIFs to muted looping autoplaying MP4 videos for greatly reduced file size.
  • Lazy loads images (using native loading=lazy).
  • Async decodes images (using decoding=async).
  • Lazy layout of images and placeholders using content-visibility: auto.
  • Avoids CLS impact of images by inferring and providing width and height (Supported in Chrome, Firefox and Safari 14+).
  • Downloads remote images and stores/serves them locally.
  • Immutable URLs.

CSS

  • Defaults to the compact "classless" Bahunya CSS framework.
  • Inlines CSS.
  • Dead-code-eliminates / tree-shakes / purges (pick your favorite word) unused CSS on a per-page basis with PurgeCSS.
  • Minified CSS with csso.

Miscellaneous

  • Immutable URLs for JS.
  • Sets immutable caching headers for images, fonts, and JS (CSS is inlined).
  • Minifies HTML and optimizes it for compression. Uses html-minifier with aggressive options.
  • Uses rollup to bundle JS and minifies it with terser.
  • Prefetches same-origin navigations when a navigation is likely.
  • If an AMP files is present, optimizes it.

Fonts

  • Serves fonts from same origin.
  • Makes fonts display:optional.

Analytics

  • Supports locally serving Google Analytics's JS and proxying it's hit requests to a serverless function proxy (other proxies could be easily added).
  • Supports sending Core Web Vitals metrics to Google Analytics as events.
  • Support for noscript hit requests.
  • Avoids blocking onload on analytics requests.
  • To turn this on, specify googleAnalyticsId in metadata.json. (Note, that this is not compatible with the not-yet-commonly used version 4 of Google Analytics.)

DX features

  • Uses 🚨 as favicon during local development.
  • Supports a range of default tests.
  • Runs build and tests on git push.
  • Sourcemap generated for JS.

SEO & Social

  • Share button preferring navigator.share() and falling back to Twitter. Using OS-like share-icon.
  • Support for OGP metadata.
  • Support for Twitter metadata.
  • Support for schema.org JSON-LD.
  • Sitemap.xml generation.

Largely useless glitter

  • Read time estimate.
  • Animated scroll progress bar…
  • …with an optimized implementation that should never cause a layout.

Security

Generates a strong Content-Security-Policy (CSP) using HTTP headers.

  • Default-src is self.
  • Disallows plugins.
  • Generates hash based CSP for the JS used on the site.
  • To extend the CSP with new rules, see CSP.js

Build performance

  • Downloaded remote images, and generated sizes are cached in the local filesystem…
  • …and SHOULD be committed to git.
  • .persistimages.sh helps with this.

Disclaimer

This is not an officially supported Google product, but rather Malte's private best-effort open-source project.

eleventy-high-performance-blog's People

Contributors

zachleat avatar cramforce avatar dependabot[bot] avatar mathiasbynens avatar benjifs avatar andrealeardini avatar indcoder avatar nlbao avatar clottman avatar verlok avatar nhoizey avatar styfle avatar krzychukula avatar nickfalcone avatar nick-novak avatar nilsmielke avatar omair-inam avatar spekulatius avatar pierlon avatar robdodson avatar mesaugat avatar stevedunn avatar lonekorean avatar zoltanveres avatar dhoman avatar fschoenfeldt avatar onezerodigits avatar mufidu avatar lancechentw avatar kitt avatar

Stargazers

Classic Values avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.