Loading...

Loading...

Performance Optimization

This page explains the blog’s performance optimization measures: image lazy loading, asset minification, CDN acceleration, image format optimization, and LCP (largest contentful paint) optimization principles. Most optimizations work out of the box — the key is understanding the layered strategy and not breaking it when adding resources.

How to read: each optimization gives the Effect first (what changes in the output/network/rendering, quantified where possible), then the corresponding config/source that produces it and the verification command.

1. Lazy Loading (lazyload)

Purpose: images and comment plugins outside the visible area aren’t loaded in advance, reducing first-screen requests and traffic. Config lives in the theme config (edit userConfig/_config.tmp.yml for production).

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

1.1 How to enable

Effect: <img> tags outside the first screen send no image request on page load; the request fires only when scrolling within offset_factor × viewport height of the viewport. A placeholder (light/dark pair) shows while loading, so first-screen concurrent requests drop.

Corresponding config (theme config):

lazyload:
  enable: true          # true | false
  loading_img: /medias_webp/loading2.svg       # loading placeholder (light)
  loading_img_dark: /medias_webp/loading2-dark.svg  # placeholder (dark)
  onlypost: false       # true = lazy loading only on post pages
  offset_factor: 2      # trigger offset multiplier (base = viewport height)

Output: after building, image tags carry loading="lazy" lazyload and data-lazy-src-light/dark pointing at the placeholder — measured:

<img src="/medias_webp/cover/hexo.webp" width="1064" height="560"
     data-lazy-src-light="/medias_webp/loading2.svg" loading="lazy" lazyload ...>

1.2 Common options

① Skip first-screen images

Effect: images with the no-lazy class load immediately and show no placeholder — good for banners, logos and other first-screen elements.

Corresponding source (add the class in Markdown):

<img src="/medias_webp/banner.webp" class="no-lazy">

② Lazy-load on post pages only

Effect: with onlypost: true, the home/standalone pages aren’t lazy-loaded and only post pages are; to opt a custom page in, write lazyload: true in its front-matter.

Corresponding config:

lazyload:
  onlypost: true

③ Tune the trigger distance

Effect: a larger offset_factor loads earlier (requests start well before reaching the bottom); smaller loads later and saves traffic; 2 means two viewport heights ahead.

Corresponding config:

lazyload:
  offset_factor: 3

1.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
lazyload.enablebooltruetrue / falsemaster lazy-load switch
lazyload.loading_imgstring/medias_webp/loading2.svgimage pathlight placeholder
lazyload.loading_img_darkstring/medias_webp/loading2-dark.svgimage pathdark placeholder
lazyload.onlypostboolfalsetrue / falsepost pages only
lazyload.offset_factornumber2positive number (viewport multiples)early trigger distance

1.4 Boundaries & conflicts

  • Adding the no-lazy class to an element skips lazy loading (e.g. a first-screen banner).
  • With onlypost: false it applies site-wide; a custom page can opt in by writing lazyload: true in front-matter.
  • Tune offset_factor by deployment request speed: larger loads earlier (lazy loading kicks in nearer the bottom).

1.5 Summary

  • Minimum viable: enable: true
  • Placeholder flashes on the first screen: add no-lazy to first-screen images
  • Too much traffic: lower offset_factor (loads later)

2. Asset Minification (hexo-minify)

Purpose: minify JS/CSS/HTML at build time to reduce size. Root config _config.yml.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

2.1 How to enable

Effect: .js/.css/.html under public/ lose comments and redundant whitespace and shorten attribute quotes, so individual files shrink; local hexo server doesn’t minify because of preview: false, so compare using the output of npm run build.

Corresponding config (root _config.yml):

minify:
  preview: false            ## whether to minify during local preview (false = minify in production)
  exclude: ['*.min.*']      # skip already-minified files
  js:   { enable: true }    # JS minification
  css:  { enable: true }    # CSS minification
  html:
    enable: true
    options:
      minifyJS: true        # minify inline JS in HTML
      minifyCSS: true       # minify inline CSS in HTML
      removeComments: true  # strip comments
      collapseWhitespace: true # strip extra whitespace
      removeAttributeQuotes: true
  image:
    enable: false           # image minification off by default (images have their own optimization, see section 4)

Output: comments disappear from the built HTML and consecutive whitespace collapses; compare a file before/after with wc -c.

2.2 Common options

① Minify locally too (for debugging)

Effect: hexo server serves minified pages, making it easy to verify that styles/scripts still work after minification; the cost is harder-to-read local debugging.

Corresponding config:

minify:
  preview: true

② Exclude already-minified libraries

Effect: *.min.* is not minified a second time, avoiding damage to minified files and saving build time.

Corresponding config:

minify:
  exclude: ['*.min.*']

③ Minify HTML only

Effect: only HTML whitespace and comments collapse; JS/CSS files are output as-is (easier to inspect side by side).

Corresponding config:

minify:
  js:  { enable: false }
  css: { enable: false }
  html:
    enable: true

2.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
minify.previewboolfalsetrue / falseminify during local preview
minify.excludearray['*.min.*']glob listfiles to skip
minify.js.enablebooltruetrue / falseJS minification
minify.css.enablebooltruetrue / falseCSS minification
minify.html.enablebooltruetrue / falseHTML minification
minify.html.options.*objectsee abovehtml-minifier optionsHTML minification details
minify.image.enableboolfalsetrue / falseimage minification (off in this project)

2.4 Boundaries & conflicts

  • preview: false means local hexo server doesn’t minify; to verify minification use npm run build (see the Deployment chapter).
  • The switches are controlled by # minify-switch marker lines in the root _config.yml; tools/cicd.sh sed-switches them per build mode (-d off, -r/-c/-t on) and restores them automatically after the build.
  • Turning off HTML minification affects inline-script whitespace; if a page depends on inline-script formatting, disable html.minifyJS alone first.

2.5 Summary

  • Minimum viable: keep the defaults (js/css/html all on, preview: false)
  • Debugging styles: preview: true, or read the unminified output
  • Only shrink HTML: turn off the js/css items

3. CDN Acceleration

Purpose: static assets are served from jsDelivr’s global nodes, fetched from the nearest edge. The mechanism is placeholder injection: templates contain {cdnPathVersion}, replaced with real CDN URLs at CI build time (see the CDN section of the Global Configuration chapter).

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

3.1 How to enable

Effect: after an -r build, theme asset URLs in the HTML change from in-site relative paths to https://cdn.jsdelivr.net/gh/...@<version>/..., so users fetch JS/CSS from the nearest node; a -d (debug) build clears the CDN placeholders and stays on the site’s own domain.

Corresponding config (template userConfig/_config.tmp.yml, injected into the theme config at build time):

# theme config
jsDelivr:
  url: {cdnPathVersion}      # versioned CDN path (replaced at build time)
  latesturl: #{cdnPathLatest} # latest path (commented out, not enabled)
cdn:
  url: "{cdnUrl}"            # JS/CSS CDN URL
  mediaUrl: "{mediaUrl}"     # image/media CDN URL
  resUrl: "{resUrl}"         # resource CDN URL

Output: after tools/cicd.sh -r, cdn.url in themes/matery/_config.yml is already the real domain and <script src> in the built HTML points at the CDN; after -d, the same location holds an in-site path.

3.2 Common options

① Version number (the key to caching)

Effect: -r bumps tools/.VERSION and injects {urlVersion} (e.g. ?v={urlVersion}), which is what lets CDN and browser caches pick up new files; content-only -c doesn’t bump — the CDN hits the old version, which is fine since the content didn’t change.

Corresponding command:

tools/cicd.sh -r "feature"    # bump version + CDN path
tools/purge-cdn.sh -a      # flush CDN cache (auto-called in release mode)

Output: the tools/.VERSION value grows; the ?v= in built URLs changes with it.

② Images on a separate CDN domain

Effect: image requests go through the {mediaUrl} domain, separated from JS/CSS so cache policies can be controlled independently.

Corresponding config:

cdn:
  mediaUrl: "{mediaUrl}"

3.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
jsDelivr.urlstring{cdnPathVersion}placeholderversioned CDN path
jsDelivr.latesturlstringcommentedplaceholderlatest path (not enabled)
cdn.urlstring{cdnUrl}placeholder/URLJS/CSS CDN
cdn.mediaUrlstring{mediaUrl}placeholder/URLimage/media CDN
cdn.resUrlstring{resUrl}placeholder/URLasset CDN
-r version injectioncommand——{urlVersion} bump

3.4 Boundaries & conflicts

  • The version number is key: content-only changes with -c don’t bump it, so if you also changed static assets on the CDN (not post content), the cache won’t update — use -r for that case.
  • {cdnPathLatest} is commented out in the template and not actually enabled; referencing latest breaks the cache-invalidation strategy.
  • -d builds clear the CDN config, so local preview can’t show the CDN effect; verify CDN using the output of -r/-c/-t.

3.5 Summary

  • Minimum viable: release with -r, the CDN is injected automatically
  • Changed but not updated: check whether the version number was bumped
  • No CDN locally: expected, -d clears it

4. Image Optimization (webp)

Purpose: images are the biggest chunk of this blog’s size. Site images are uniformly webp, far smaller than jpg/png, and distributed via CDN. webp files live in the theme source themes/matery/source/medias_webp/ (copied to public/medias_webp/ at build time; URLs use /medias_webp/...).

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

4.1 How to enable

Effect: all in-site image requests land on /medias_webp/*.webp (or .svg placeholders), transferring fewer bytes than same-size jpg/png; browsers decode webp directly with no extra JS.

Corresponding source (existing image library paths, examples):

# example: the featureimages library is all webp
/medias_webp/featureimages/0.webp
/medias_webp/avatar.webp
/medias_webp/loading2.svg       # SVG placeholder (vector, tiny)

Output: after building, public/medias_webp/ holds these files; the HTML src attributes point at them.

4.2 Common options

① Convert new images to webp before committing them

Effect: new images match the rest of the site — small, and handled correctly by lazy loading and the CDN.

Corresponding command (cwebp isn’t installed with the repo; the example is unverified — adjust the parameters to the actual image):

cwebp -q 82 input.jpg -o output.webp

Output: output.webp is produced and copied on build once placed in the image repo.

② Sync the image repos

Effect: images in the image repos (submodules) are synced before the build, and imgurl.sh processes the URLs so page references are correct.

Corresponding command:

tools/processRepo.sh     # LFS checkout + sync cloudimg/cloudmedia

Output: userConfig/cloudimg/ and userConfig/cloudmedia/ hold the latest content; the build log shows no LFS errors.

4.3 All tunable keys

OptionLocationPurpose
/medias_webp/theme source/uniform in-site image path
userConfig/cloudimg/submoduleimage repo (synced by processRepo.sh)
userConfig/cloudmedia/submodulemedia repo
minify.image.enableroot _config.ymloff in this project (webp is already the final form)

4.4 Boundaries & conflicts

  • New images should be converted to webp before committing: the image repo is the submodule userConfig/cloudimg/ (synced by tools/processRepo.sh), and imgurl.sh processes URLs at build time.
  • Image loading follows §1 lazy loading + §3 CDN distribution, both layers stacking.
  • hexo-minify’s image.enable is off by default — in-site webp is already the final form and needs no second compression.
  • The old medias/ (jpg) library is deprecated; don’t reference .jpg paths in new content.

4.5 Summary

  • Minimum viable: convert new images to webp before putting them in the image repo
  • Size comparison: same-size webp < jpg/png
  • Don’t enable image minification: keep minify.image.enable at false

5. LCP Optimization Principles (JS Layering)

Purpose: LCP (Largest Contentful Paint) is the key first-screen metric. A round of JS loading-strategy layering was completed on 2026-08-11; the principle is first-screen essentials synchronous, the rest defer, heavy items on demand.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

5.1 How to enable

Effect: only utils + colorSchema load synchronously on the first screen; the remaining scripts download in parallel with defer and don’t block parsing, and heavy libraries (mermaid/mathjax/echarts) are injected only on pages that need them. Measured LCP dropped from 4.2s to 1.8s (57% reduction).

Corresponding source (layout/_partial/common/scripts.ejs + head.ejs); the layering table follows.

LayerJSLoadingRationale
L0 critical syncutils + colorSchema (+ export_config() / inline language injection)synchronous (in head)global namespace/config dependencies, needed for the first screen; jQuery already removed
L1 defermaterialize/masonry/imagesloaded/aos/events/plugins/lightgallery/search enginesdeferparallel download without blocking parsing; defer preserves execution order
L2 on-demand dynamictyped/mermaid/mathjax/echarts/tocbotconditional dynamic injectionzero first-screen cost
L3 asyncumami/busuanzi etc. analyticsasyncnever blocks rendering

5.2 Common options

① Three disciplines when adding your own JS

Effect: a new script doesn’t slow the first screen — it doesn’t block parsing, doesn’t disturb the global foundation, and heavy libraries never enter the site-wide bundle.

Corresponding source:

  1. defer by default: <script src="..." defer></script>, never block synchronously
  2. Don’t touch the L0 utils/colorSchema: they are the global namespace foundation; synchronous loading is a design decision
  3. Load heavy libraries on demand: libraries like mermaid/mathjax/echarts that only appear on specific pages shouldn’t be in the site-wide scripts — inject them on conditional trigger

② Verify that defer is in effect

Effect: the theme script tags in the built HTML carry defer, proving it hasn’t fallen back to synchronous blocking.

Corresponding command:

grep -o '<script[^>]*defer[^>]*>' public/index.html | head -3

Output (measured):

<script defer src="/js/wiki.js?v=13.27" >
<script defer src="/js/search.js?v=13.27" >

5.2.1 jQuery Removal & Script Layering Details (P4/P5 site-wide complete 2026-09-05)

The theme has removed jQuery site-wide, switching to native DOM APIs (querySelector / addEventListener / classList / getComputedStyle etc.). Current status of the jQuery-related items in themes/matery/_config.yml libs.js.* (sources: themes/matery/_config.yml, themes/matery/layout/_partial/common/scripts.ejs):

Config itemStatusBasis
libs.js.jqueryDisabled (commented out)Comment: “2026-09-05 disabled: P4/P5 site-wide jQuery removal complete”
libs.js.jqueryUIConfig key retained (_config.yml not commented), but the matching <script> in scripts.ejs is commented out → not actually loadedthe key still exists in _config.yml
libs.js.jqueryBarragerDisabled (commented out)Disabled after the contact page was removed (jQuery barrage deprecated)
libs.js.jqueryPjaxConfig key retainedNo references remain in layout/, scripts/, or source/js/

As a result, the L0 layer in the §5 table no longer includes jquery — the synchronous layer holds only utils.js + color-schema.js.

Critical inline scripts must precede defer (sources: head.ejs, scripts.ejs):

  • head.ejs synchronously loads utils + colorSchema and synchronously runs export_config() (injects window.CONFIG) — they must precede all defer scripts so those can read the global namespace/config.
  • In scripts.ejs, the multilingual config MATERY_LANG and i18n copy MATERY_I18N are synchronous inline <script> tags, deliberately placed before wiki.js (defer); the source comment reads “injected as synchronous script, guaranteed to execute before all defer scripts”.

Loading-method classification:

  • defer: materialize / masonry / imagesloaded / aos / events / plugins / search / scrollProgress / lightgallery / boot; instantpage is type="module" (module already implies defer semantics; no defer attribute added).
  • async: umami / busuanzi / tagCommon (analytics and comment helpers, non-render-blocking).
  • Conditional (specific pages/layouts only): typed / mermaid / mathjax / echarts / tocbot.

5.3 All tunable keys

OptionLocationValuesPurpose
Script loading methodscripts.ejs / head.ejssync / defer / async / dynamic injectionwhether first-screen parsing is blocked
libs.js.jquerythemes/matery/_config.ymlcommented (disabled)jQuery already removed
libs.js.instantpagesame as abovetype="module"module carries defer semantics
Conditional trigger listcorresponding templatesspecific pages onlytyped/mermaid/mathjax/echarts/tocbot

5.4 Boundaries & conflicts

JS compatibility pitfall (2026-09-22): classList.add('a b') with a space-separated multi-class string throws InvalidCharacterError (DOMTokenList rejects spaces) — use classList.add('a', 'b') or split and add individually. The homepage once failed this way.

  • Changing L0 scripts to defer leaves other scripts unable to read window.CONFIG, causing a blank first screen or undefined errors.
  • Adding a third-party library synchronously rolls LCP back — prefer on-demand injection.

5.5 Summary

  • Minimum viable: every new script uses defer
  • Changing L0: first check which scripts depend on window.CONFIG
  • Heavy libraries: inject on conditional trigger, never in the site-wide bundle
  • Multiple classes: classList.add('a','b'), no spaces

6. Page Preloading (instantpage)

Purpose: preload the target page when the user hovers a link, making clicks open almost instantly.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

6.1 How to enable

Effect: a few tens of milliseconds after hovering an in-site link, the Network panel shows a prefetch request for the target page; clicking renders from cache, which feels faster. Mobile has no hover, so no preloading happens there.

Corresponding config (theme config):

instantpage:
  enable: true

Output: the page loads the instantpage script (type="module", equivalent to defer), and that <script> is visible in the output.

6.2 Common options

① Turn it off

Effect: no more hover prefetch requests, saving traffic; clicking loads the target page normally.

Corresponding config:

instantpage:
  enable: false

6.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
instantpage.enablebooltruetrue / falsehover preload switch

6.4 Boundaries & conflicts

  • Built on instant.page; with enable: true it applies site-wide, and on mobile (no hover) it degrades automatically without preloading.
  • Prefetching only happens for in-site links; external links are unaffected.

6.5 Summary

  • Minimum viable: enable: true
  • Traffic-sensitive: turn it off and load on click

7. Dark Feature Images (darkFeatureImages)

Purpose: the feature image library for dark mode — the dark counterpart of featureimages, used for random picks in dark mode.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

7.1 How to enable

Effect: in dark mode the banner/cover picks images from the dark/ directory, and switching back to light picks from the original library; the same title still maps to a stable image by hash.

Corresponding config (theme config):

darkFeatureImages:
  - /medias_webp/featureimages/dark/0.webp
  - /medias_webp/featureimages/dark/1.webp
  - /medias_webp/featureimages/dark/2.webp
  # ... more dark images

Output: in dark mode the img/background addresses become /medias_webp/featureimages/dark/N.webp.

7.2 Common options

① Add more dark images

Effect: more candidates in the dark library, so different posts are more likely to get different images.

Corresponding config: append paths to the list (images go in themes/matery/source/medias_webp/featureimages/dark/).

7.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
darkFeatureImagesarray—list of image pathsrandom image pool for dark mode

7.4 Boundaries & conflicts

  • Corresponds to the light featureimages library; in dark mode, banner/cover random picks come from this list. Images go in themes/matery/source/medias_webp/featureimages/dark/.
  • A missing file makes the dark image request 404, and the page falls back to the placeholder/default image.

7.5 Summary

  • Minimum viable: list a few dark/N.webp entries
  • Wrong image: confirm the file really is in the dark/ directory

8. Image Size Plugin (image_size_plugin)

Purpose: automatically add width/height attributes to images at build time to prevent layout shift (CLS); supports mapping local images to online CDN paths.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

8.1 How to enable

Effect: built <img> tags gain width="1064" height="560" (measured on the homepage cover), so the browser reserves space before the image downloads and CLS drops.

Corresponding config (theme config):

image_size_plugin:
  enable: true
  proxy_url:        # image proxy address (e.g. http://xray:10089)
  debug: true       # true | false print switch
  onlypost: false   # true = only process post images
  # local image paths (array: theme assets + site post images)
  local_path:
    - themes/matery/source
    - source
  # local path index for mapping to online paths
  map_paths:
    - userConfig/cloudmedia
    - userConfig/cloudimg
    - themes/matery/source
  # local-to-online path mapping
  map_paths_web_root:
    userConfig/cloudmedia: https://cdn.17lai.site
    userConfig/cloudimg: https://cimg1.17lai.site

Output: after building, <img> carries width/height; with debug: true the build log prints the processed images.

8.2 Common options

① Skip processing

Effect: images with the no-size class, or that already carry width/height, are output as-is without rewriting.

Corresponding source (Markdown):

<img src="/medias_webp/xxx.webp" class="no-size">

② Map local paths to the CDN

Effect: local image paths matching map_paths are replaced with the online addresses configured in map_paths_web_root, so no local path appears in the output.

Corresponding config:

image_size_plugin:
  map_paths:
    - userConfig/cloudimg
  map_paths_web_root:
    userConfig/cloudimg: https://cimg1.17lai.site

8.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
image_size_plugin.enablebooltruetrue / falsemaster switch for adding dimensions
image_size_plugin.proxy_urlstringemptyproxy addressproxy for probing remote images
image_size_plugin.debugbooltruetrue / falseprint processing logs
image_size_plugin.onlypostboolfalsetrue / falsepost pages only
image_size_plugin.local_patharraysee abovedirectory listlocal image lookup roots
image_size_plugin.map_pathsarraysee abovedirectory listlocal path mapping sources
image_size_plugin.map_paths_web_rootmapsee abovedirectory → URLonline address mapping

8.4 Boundaries & conflicts

  • Images with the no-size class, or that already carry width/height, are skipped; map_paths + map_paths_web_root replace local image paths with online CDN addresses (images in the image-repo submodules userConfig/cloudimg, userConfig/cloudmedia go through this mapping).
  • Remote images need proxy_url to have their size probed, otherwise they’re skipped (no width/height added).

8.5 Summary

  • Minimum viable: enable: true
  • Verify: grep -o '<img[^>]*width="[0-9]*"' public/index.html | head on the output
  • Don’t process one image: add no-size

9. CSS Async + SEO (2026-09-07)

Purpose: eliminate render-blocking CSS and fill in the metadata search/share needs.

Learning path: How to enable → Non-critical CSS → Structured data → Share image → LCP element → All tunable keys → Boundaries & conflicts

9.1 How to enable

Effect: animation-library CSS loads non-blockingly, so first-screen rendering isn’t stuck on it; the page head also gains JSON-LD structured data and og:image, which search engines and social platforms read for title/description/cover.

Corresponding config/source: the four implementations are in 9.2–9.5, all built into the theme and on by default.

Output: the built HTML can be grepped for media="print", application/ld+json and <meta property="og:image"> at the same time (all verified present).

9.2 Non-critical CSS async loading

Effect: the page head contains a <link> with media="print" onload="this.media='all'"; the media switches back to all only once the CSS has downloaded, so it doesn’t block first-screen rendering; with JS disabled, a <noscript> fallback covers it.

Corresponding source (layout/_partial/common/css.ejs):

<link rel="stylesheet" href="..." media="print" onload="this.media='all'">
<noscript><link rel="stylesheet" href="..."></noscript>

Output: that <link> in the output carries media="print" and onload; aos/animate.css no longer appear in the render-blocking CSS list.

Note: when rel="stylesheet preload" and a plain stylesheet point at the same URL, the browser deduplicates automatically (no double download) — no need to remove either.

9.3 SEO structured data (JSON-LD)

Effect: the built HTML contains application/ld+json (verified present) with the site name, post title/description/date/author/cover and a SearchAction, from which Google can generate rich results.

Corresponding source (theme-built-in layout/_partial/common/structured-data.ejs, injected automatically):

  • WebSite (site-wide): site name + SearchAction (sitelinks searchbox rich result)
  • BlogPosting (post pages): headline/description/date/author/cover/keywords/category
  • Person + Organization: cross-referenced via @id (avoids duplicate data)

Output: grep -o 'application/ld+json' public/index.html returns hits.

9.4 Social share image (og:image)

Effect: on post pages og:image is the post cover; home/list pages fall back to the default image (measured: the homepage outputs /medias_webp/featureimages/0.webp).

Corresponding config:

# theme config (must also sync userConfig/_config.tmp.yml)
open_graph:
  default_og_image: /medias_webp/featureimages/15.webp

Output: <meta property="og:image" content="...">.

Priority: page.img (post image) → theme.default_og_image (default) → theme.featureImages[0]. Post pages use the post cover; home/list pages use the default image.

9.5 LCP element priority

Effect: first-screen images such as the logo carry fetchpriority="high", so the browser downloads them first and LCP comes earlier.

Corresponding source: built into header/mobile-nav.

Note: the home banner background is JS-injected (random image rotation) and must not be changed to CSS output — that would break the random rotation.

9.6 All tunable keys

OptionLocationValuesPurpose
media="print" onloadcss.ejson/offnon-critical CSS async
JSON-LD injectionstructured-data.ejsbuilt-insearch-engine rich results
open_graph.default_og_imagetheme configimage pathshare image when a post has none
fetchpriority="high"header/mobile-navbuilt-infirst-screen image priority

9.7 Boundaries & conflicts

  • rel="stylesheet preload" and a plain stylesheet with the same URL are deduplicated by the browser automatically; duplicate declarations don’t double-download, but add an extra tag.
  • All JSON-LD data comes from existing variables (config.title/url/author/language + page.*) and needs no manual maintenance; validate with Google Rich Results Test (after production deploy).
  • The home banner background must stay JS-injected; changing it to CSS output breaks the random rotation.

9.8 Summary

  • Minimum viable: all four are theme built-ins, on by default
  • Verify structured data: grep -o 'application/ld+json' public/index.html
  • Share has no image: configure default_og_image
  • Don’t touch the banner: random rotation depends on JS injection

Appendix: Performance Optimization Quick Reference

MeasureConfig locationKey points
Lazy loadingtheme config lazyloadno-lazy class skips; onlypost controls scope
Asset minificationroot _config.yml minifylocal preview not minified; -d disables
CDNtheme config jsDelivr/cdn-r bumps the version to flush caches
Images/medias_webp/ + CDNuniform webp; image repo is a submodule
LCP layeringlayout/_partial/common/scripts.ejsL0 sync / L1 defer / L2 on-demand / L3 async
CSS asynclayout/_partial/common/css.ejsaos/animate via media="print" onload
SEO structuredlayout/_partial/common/structured-data.ejsauto JSON-LD WebSite + BlogPosting
Social share imagetheme config default_og_imagefallback default image for home/list (also sync userConfig/_config.tmp.yml)
LCP elementheader/mobile-nav logo imgfetchpriority="high"
Comments
Data Loading...