Loading...

Loading...

Interactions & Visual Effects

This page covers the interaction & visual features of the matery theme: code block enhancements, image lightbox, typewriter, page effects, simplified/traditional Chinese conversion, reading progress, back-to-top, rewards, print styles, audio/video players and charts. Each feature lists its config location and how to use it.

How to read this page: every feature is shown as a pair — Effect → Corresponding config. Look at what it produces first, then copy the YAML below. Every key in the parameter tables appears either on this page or in userConfig/_config.tmp.yml; unverified values are marked “other values unverified”.

Config locations are all in the theme config themes/matery/_config.yml (“theme config” below). Note: in this project the theme config file is overwritten by the userConfig/_config.tmp.yml template during CI builds — sync your changes to the template (see the Installation chapter). Some features have no dedicated config key (back-to-top, print styles) — they are built into the theme and work out of the box.

1. Code Block Enhancements

Purpose: code blocks automatically get a language label, copy button, expand/collapse and fullscreen view; overly long code is height-limited.

Learning path: Enable the language label → configure copy and expand → tune the height limit → full parameter table → Boundaries & conflicts

1.1 How to enable

Effect: the code block below is the real rendering — a language label in the top-right, a copy button on hover:

echo "Hello Matery"

Corresponding config (minimum viable: language label + copy button, everything else at default):

code:
  language:
    enable: true
    default: "TEXT"
  copy_btn: true

Standard Markdown code blocks are enhanced automatically; no extra marker syntax is needed.

1.2 Common options

① Height limit and expand

Effect: code blocks taller than height_limit (450px) are collapsed by default with an “expand” bar at the bottom; clicking it shows the full block with no height limit.

Corresponding config:

code:
  height_limit: "450px"   # auto-collapse above this height
  show_full: true         # show the "expand" bar in the collapsed state

② Manual collapse

Effect: a collapse button appears in the code block toolbar so readers can manually collapse / expand the whole block.

Corresponding config:

code:
  shrink: true

③ Language label fallback

Effect: when no language is written or the language is unrecognized, the top-right label shows the copy specified by default (default TEXT).

Corresponding config:

code:
  language:
    enable: true
    default: "TEXT"    # use "CODE" to show CODE instead

④ Copy button

Effect: a copy button appears on hover; clicking copies the whole block. With false only the language label remains in the top-right.

Corresponding config:

code:
  copy_btn: true

⑤ Fullscreen view

Effect: a fullscreen button appears in the toolbar; clicking makes that code block fill the viewport (this is the other code-fullscreen entry besides the §17 preference panel).

Corresponding config:

code:
  show_expand: true

⑥ Wrapping over-wide lines

Effect: with break: false, over-wide lines do not wrap but scroll horizontally (this project uses that value); true wraps them.

Corresponding config:

code:
  break: false

1.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
code.shrinkbooltruetrue / falseCode block collapsible (fold button)
code.breakboolfalsetrue / falseWhether long lines wrap; false scrolls horizontally
code.show_fullbooltruetrue / falseShow the “expand all” button for long code
code.height_limitstring"450px"CSS length with a unit (px etc.)show_full height threshold
code.show_expandbooltruetrue / falseFullscreen view button
code.copy_btnbooltruetrue / falseCopy code button
code.language.enablebooltruetrue / falseShow the language label
code.language.defaultstring"TEXT"any stringDefault label when no language is given

1.4 Boundaries & conflicts

  • height_limit maps to the CSS variable --code-max-height; when expanded, JS sets the container’s maxHeight to scrollHeight (no longer bounded by that value), and on collapse restores it to empty, back to 450px.
  • copy_btn / show_full / shrink are three independent buttons, combinable freely; turn all off and only a bare code block remains.
  • The language label is only output when language.enable: true; unrecognized languages fall back to language.default.
  • Changing any item in this section requires a clean build to take effect (the cache does not notice config changes).

1.5 Summary

  • Minimum viable: language.enable + copy_btn — two lines are enough.
  • Afraid of exploding long posts: tune height_limit; show_full provides the “expand” bar.
  • Changes don’t apply: suspect the cache first; do a clean build.

2. Image Lightbox (lightGallery)

Purpose: post images click to enlarge into fullscreen browsing, with zoom, paging and download, plus auto-generated captions.

Learning path: Enable the lightbox → plain images suffice → swap in original image links → full parameters → boundaries

2.1 How to enable

Effect: images in a post become clickable; clicking opens a black-overlay lightbox with zoom / paging / download; the caption generated from image_caption appears below the image.

Corresponding config (theme config, inside the post block):

post:
  image_zoom:
    enable: true            # post images clickable to enlarge

Example (a plain Markdown image is enough, auto-enhanced):

![image description](/medias_webp/featureimages/1.webp)

2.2 Common options

① Link replacement (thumbnail → original)

Effect: the lightbox loads the replaced original-image link while the list still shows the compressed image — saving bandwidth without sacrificing zoom quality.

Corresponding config:

post:
  image_zoom:
    img_url_replace: ['-slim', '']   # strips -slim from the link; use a 're:' prefix for regex

② Disable the lightbox

Effect: images are not clickable and nothing happens on click; links display as before.

Corresponding config:

post:
  image_zoom:
    enable: false

2.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
post.image_zoom.enablebooltruetrue / falsePost images clickable to enlarge
post.image_zoom.img_url_replacearray['', ''][search, replace]; use a re: prefix for regexLink replacement rule when enlarging

The lightbox library itself is loaded via libs.js.lightgallery / libs.css.lightgallery (local /libs/lightGallery/...), not via image_zoom keys; other values unverified.

2.4 Boundaries & conflicts

  • Lightbox initialization happens on post pages (#articleContent / #myGallery); Matery.plugins.lightgallery(selector) returns immediately for those two containers and does not initialize twice. Wiki pages unverified.
  • The lightbox depends on lightgallery-all.min.js being loaded; when missing, the function simply returns and clicking images does nothing.
  • img_url_replace is a paired replacement; wrong ordering corrupts links — when unsure keep the default ['', ''] (no replacement).

2.5 Summary

  • It should be on by default: one line enable: true gives plain images the lightbox.
  • Blurry on zoom: use img_url_replace to swap back to the original link.
  • Clicking does nothing: first check whether the lightgallery assets loaded.

3. Typewriter (Typed)

Purpose: banner subtitle character-by-character rotation and post page title typing animation.

Learning path: Enable subtitle typing → configure the sentence list → enable post title typing → limit pages → full parameters → conflicts

3.1 How to enable

Effect: the homepage banner subtitle types out from empty, pauses, deletes and moves to the next sentence; post page H2 titles appear the same way, with a blinking cursor.

Corresponding config (theme config, minimum viable — subtitle typing only):

fun_features:
  typing:
    enable: true

3.2 Common options

① Banner subtitle typing (subtitle block, including speed and rotation)

Effect: rotates through the sentences in the sub list, looping, with _ as the cursor.

Corresponding config:

subtitle:
  enable: true
  typed:
    loop: true          # loop rotation
    showCursor: true    # show cursor
    cursorChar: "_"     # cursor character
    startDelay: 100     # start delay (ms)
    typeSpeed: 80       # typing speed (ms/char)
    backSpeed: 50       # deleting speed (ms/char)
  sub:                  # rotation sentence list (typed one by one)
    - 真经一句话,假经传万卷!

② Another entry: fun_features.typing (with page scope)

Effect: a second switch entry for the same subtitle typing effect; an empty scope enables it site-wide, while page names limit typing to those pages only.

Corresponding config:

fun_features:
  typing:
    enable: true
    typeSpeed: 70
    cursorChar: "_"
    loop: false
    scope: []           # home | post | tag | category | about | links | page | 404 (empty = all)

③ Post page H2 title typing

Effect: H2 titles in posts (and other layouts) appear character by character; when disabled the title displays directly with no animation.

Corresponding config:

post:
  typed:
    enable: true
    loop: false
    showCursor: true
    cursorChar: "_"
    startDelay: 50
    typeSpeed: 70
    backSpeed: 50

3.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
subtitle.enablebooltruetrue / falseBanner subtitle area master switch
subtitle.typed.loopbooltruetrue / falseWhether to loop
subtitle.typed.showCursorbooltruetrue / falseShow cursor
subtitle.typed.cursorCharstring"_"any characterCursor character
subtitle.typed.startDelaynumber100msStart delay
subtitle.typed.typeSpeednumber80ms/char, larger = slowerTyping speed
subtitle.typed.backSpeednumber50ms/charDeleting speed
subtitle.subarrayseveral Chinese sentencesany string listRotation sentences
fun_features.typing.enablebooltruetrue / falseSubtitle typing switch (second entry)
fun_features.typing.typeSpeednumber70ms/charTyping speed
fun_features.typing.cursorCharstring"_"any characterCursor character
fun_features.typing.loopboolfalsetrue / falseWhether to loop
fun_features.typing.scopearray[]home post tag category about links page 404Pages to enable (empty = all)
post.typed.enablebooltruetrue / falsePost H2 title typing
post.typed.loopboolfalsetrue / falseWhether to loop
post.typed.showCursorbooltruetrue / falseShow cursor
post.typed.cursorCharstring"_"any characterCursor character
post.typed.startDelaynumber50msStart delay
post.typed.typeSpeednumber70ms/charTyping speed
post.typed.backSpeednumber50ms/charDeleting speed

3.4 Boundaries & conflicts

  • subtitle.typed and fun_features.typing are two independent entries, both belonging to the banner subtitle; before editing, confirm which one is actually in effect (when both are on, the code’s read order decides; other combinations unverified).
  • scope only accepts the 8 page names in the table above; a wrong name simply means that page is not enabled (no error).
  • post.typed applies to H2 and does not affect the banner; with loop: false typing stops on the complete title.
  • After changing config you must do a clean build.

3.5 Summary

  • Only want subtitle typing: one line fun_features.typing.enable.
  • Want to control which pages type: use scope; don’t turn off the master switch.
  • Section titles are moving too: that’s post.typed, an independent switch.

4. Page Effects

Purpose: 13 decorative effects in two categories — page/background effects (auto-run) and mouse/click effects (interaction-triggered), switchable at runtime via the floating panel on the right.

Learning path: Enable the master switch → pick a page effect → pick a mouse effect → desktop gating → runtime switching → full parameters → conflicts

4.1 How to enable

Effect: the selected decorative animation appears (e.g. sakura petals falling continuously); the selected click effect appears on mouse move/click; mobile does not load them by default.

Corresponding config (theme config effects block, the single config source after the 2026-08-10 refactor):

effects:
  enable: true            # master switch: whether the "Page Effects" area shows in the floating panel
  page:
    default: sakura       # sakura
  mouse:
    default: off

4.2 Common options

① Page/background effects (single select)

Effect: only the one named by default takes effect — sakura shows sakura, ripples shows ripples, off adds nothing, random picks one from available each time.

Corresponding config:

effects:
  page:                   # page/background effects (mutually exclusive, pick one)
    default: off          # default: off | random | specific id
    available:
      sakura:         { label: 樱花,     lib: sakura }
      ripples:        { label: 水波,     lib: ripples }
      leaf:           { label: 落叶,     lib: leaf }
      snowdown:       { label: 飘雪,     lib: snowdown }
      snowflake:      { label: 雪花,     lib: snowflake }
      buble:          { label: 冒泡,     lib: buble }
      canvas_nest:    { label: 网络,     lib: canvas_nest }
      ribbon:         { label: 彩带,     lib: ribbon }
      ribbon_dynamic: { label: 动态彩带, lib: ribbon_dynamic }

② Mouse/click effects (single select)

Effect: the matching feedback appears on click or mouse move — clicklove hearts, mouseStar stars, fireworks explosions, popupText popup text.

Corresponding config:

effects:
  mouse:                  # mouse/click effects (mutually exclusive, pick one)
    default: off
    available:
      clicklove:      { label: 爱心,     lib: clicklove }
      popupText:      { label: 弹出文字, lib: popupText }
      mouseStar:      { label: 星星,     lib: star }
      fireworks:      { label: 爆炸,     lib: fireworks }

③ Desktop-only injection

Effect: with true, mobile does not load effect scripts at all (saves power and bandwidth); with false, mobile loads them too.

Corresponding config:

effects:
  desktop_only: true      # inject on desktop only (off on mobile for performance)

④ Runtime switching (reader side, no code changes)

Effect: right floating panel → “Page Effects” area: choose Off / Random / a specific effect; the choice is written to localStorage and takes effect after refresh, with higher priority than default in the config.

Corresponding call (equivalent to the panel operation):

localStorage.setItem('matery.effect.page', 'sakura');    // sakura appears after refresh
localStorage.setItem('matery.effect.mouse', 'clicklove'); // hearts on click after refresh
localStorage.setItem('matery.effect.page', 'off');        // disable page effects

⑤ Manually trigger loading

Effect: reads window.Matery.effects (config metadata injected by the template) and loads scripts according to the page / mouse values; with no config it is a no-op that does not error.

Corresponding call:

Matery.plugins.effects();   // inject effect scripts immediately per current config

4.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
effects.enablebooltruetrue / falseMaster switch: whether the panel’s “Page Effects” area shows
effects.desktop_onlybooltruetrue / falseInject on desktop only
effects.page.defaultstringoffoff / random / any id in availableDefault page effect (single select)
effects.page.available.<id>.labelstring—any display namePanel display copy
effects.page.available.<id>.libstring—sakura ripples leaf snowdown snowflake buble canvas_nest ribbon ribbon_dynamicLibrary actually loaded
effects.mouse.defaultstringoffoff / random / any id in availableDefault mouse effect (single select)
effects.mouse.available.<id>.labelstring—any display namePanel display copy
effects.mouse.available.<id>.libstring—clicklove popupText star fireworksLibrary actually loaded
localStorage["matery.effect.page"]string—off / random / idRuntime page-effect preference
localStorage["matery.effect.mouse"]string—off / random / idRuntime mouse-effect preference

lib corresponds to a theme.libs.js.* path key; canvas_nest / ribbon additionally support a params sub-key (color, count etc.); params for the other libraries unverified.

4.4 Boundaries & conflicts

  • The page and mouse groups are each single-select: configuring several in one group means only the one named by default takes effect.
  • The two groups persist independently: matery.effect.page and matery.effect.mouse do not interfere; after switching in the panel you must refresh the page for it to apply.
  • Desktop gate: with desktop_only: true, injection happens only when the window width exceeds the BP.fun breakpoint (~992px) and the local visit count is > 1; mobile and first-time visitors do not load it.
  • The legacy standalone sakura / ripples / clicklove enable sections have been removed and no longer participate in injection; add/remove effects by editing the available lists — the panel and runtime adapt automatically.
  • Runtime logic lives in themes/matery/source/js/plugins.js (Matery.plugins.effects); config metadata is injected into window.Matery.effects by themes/matery/layout/_partial/script/effects.ejs.

4.5 Summary

  • Minimum viable: effects.enable + one line page.default to pick an effect.
  • Several in one group does nothing: only default takes effect.
  • Nothing on desktop: check whether the width passes the breakpoint, then the visit count (first visits don’t inject).
  • Want to change your mind: use the floating panel instead of repeatedly editing config.

4.6 Festival lanterns (dengbox)

Purpose: festival lantern decorations on the left and right edges of the page (e.g. “新春/快乐”); lives in the fun_features block (distinct from the effects panel above).

Effect: when enabled, one lantern hangs on each side of the page with customizable text; disabled hides them.

Corresponding config (theme config fun_features block):

fun_features:
  dengbox:
    enable: false   # false | true
    left: 新春      # left lantern text
    right: 快乐     # right lantern text

This is a different mechanism from §4’s effects: lanterns are static decoration, not controlled by the effects panel.

5. Simplified/Traditional Chinese Conversion

Purpose: one-click traditional/simplified switching for page content, with the user’s choice remembered in localStorage.

Learning path: Enable the switch → see the button → switch via API → full parameters → conflicts

5.1 How to enable

Effect: a “繁/简” toggle button appears in the footer (#translateLink); clicking converts all body text between simplified and traditional, the button label flips accordingly, and the choice survives a refresh.

Corresponding config (theme config, consolidated into the preference section on 2026-08-16):

preference:
  translate:
    enable: true    # conversion switch

5.2 Common options

① Disable conversion

Effect: the trad/simp button no longer appears in the footer; body text always stays as written.

Corresponding config:

preference:
  translate:
    enable: false

② Switch via API (without clicking the button)

Effect: the call immediately converts the body and flips the button label; the encoding value is also written to local storage so later pages follow it.

Corresponding call:

Matery.plugins.languageToggle();              // toggle simp ↔ trad
Matery.plugins.languageToggle.getEncoding();  // read the current encoding

5.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
preference.translate.enablebooltruetrue / falseTrad/simp conversion switch (the only read point)

5.4 Boundaries & conflicts

  • The legacy footer.translate config was removed on 2026-08-10 (confirmed by the footer.ejs comment); only preference.translate.enable is read.
  • Conversion is body-text replacement; it does not change markup outside code-block text. It is separate from the i18n language dropdown (which swaps template copy).
  • The button is output based on enable; API calls beyond the button are not limited by enable.

5.5 Summary

  • One-line switch: preference.translate.enable.
  • Button missing: first confirm you didn’t write the old footer.translate.
  • Want to script it: call Matery.plugins.languageToggle() directly.

6. Reading Progress Bar / Back to Top

Purpose: a reading progress bar at the top grows while scrolling; one-click back-to-top at the bottom right.

Learning path: Enable the progress bar → tune height and color → confirm back-to-top → full parameters → conflicts

6.1 How to enable

Effect: a thin colored progress bar appears at the top of the page, growing with page load and scroll; a round button appears at the bottom right (visible after scrolling) and smoothly returns to the top.

Corresponding config (theme config; the progress bar lives in the fun_features block):

fun_features:
  progressbar:
    enable: true        # loading progress bar (off by default)
    height_px: 3
    color: "#29d"

6.2 Common options

① Height and color

Effect: the bar thickens per height_px and changes color per color, reflected immediately at the top of the page.

Corresponding config:

fun_features:
  progressbar:
    height_px: 3
    color: "#29d"

② nprogress behavior options

Effect: showSpinner turns off the spinner in the top-right; a smaller trickleSpeed makes the bar advance faster (10–100 is the common range).

Corresponding config:

fun_features:
  progressbar:
    options: { showSpinner: false, trickleSpeed: 100 }   # nprogress options

③ Back to top (no dedicated config key)

Effect: the #backTop button is built into the right floating panel, enabled by default, needs no config, scrolls smoothly and adapts its size on mobile.

Corresponding config: none. The button is output by layout/_partial/common/right-floating.ejs; see §15 for the other arrow entry.

6.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
fun_features.progressbar.enableboolfalsetrue / falseLoading progress bar switch
fun_features.progressbar.height_pxnumber3positive integer (px)Progress bar height
fun_features.progressbar.colorstring"#29d"any CSS colorProgress bar color
fun_features.progressbar.optionsobject{showSpinner:false, trickleSpeed:100}nprogress keys of the same namePassed through to nprogress

Apart from showSpinner / trickleSpeed, the other nprogress keys in options are unverified.

6.4 Boundaries & conflicts

  • The progress bar is off by default and needs an explicit enable: true.
  • Back to top has two entries: #backTop in this section (inside the floating panel) and scroll_top_arrow in §15 (a standalone arrow); both can exist at once.
  • options is passed through as-is; a wrong key name does not error, it just has no effect.

6.5 Summary

  • One line enables the progress bar: progressbar.enable: true.
  • Back to top needs no config: built in.
  • Two back-to-top buttons: if you want only one, turn off the other’s switch.

7. Reward Popup

Purpose: a “tip” button at the bottom of posts; clicking pops up a WeChat/Alipay QR code dialog.

Learning path: Enable rewards → swap QR codes → per-post override → full parameters → conflicts

7.1 How to enable

Effect: a “tip” button appears at the bottom of posts; clicking opens a QR code dialog with Alipay/WeChat tabs, closable via the close button or by clicking the overlay.

Corresponding config (theme config, inside the post block):

post:
  reward:
    enable: true
    title: 码字辛苦,打赏作者!
    wechat: /medias_webp/reward/wechat.webp
    alipay: /medias_webp/reward/alipay.webp

7.2 Common options

① Change the popup title

Effect: the copy at the top of the popup becomes the content of title.

Corresponding config:

post:
  reward:
    title: 码字辛苦,打赏作者!

② Change the QR code images

Effect: the new image shows in the corresponding tab; local paths or remote images both work.

Corresponding config:

post:
  reward:
    wechat: /medias_webp/reward/wechat.webp
    alipay: /medias_webp/reward/alipay.webp

③ Per-post override (front-matter)

Effect: the “tip” button appears at the bottom of this post (true) or not (false), taking priority over the global config.

Corresponding config:

reward: true    # true enables tipping for this post / false disables (default follows global config)

7.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
post.reward.enablebooltruetrue / falseGlobal reward button switch
post.reward.titlestring码字辛苦,打赏作者!any stringPopup title
post.reward.wechatstring/medias_webp/reward/wechat.webpimage path / URLWeChat QR code
post.reward.alipaystring/medias_webp/reward/alipay.webpimage path / URLAlipay QR code
front-matter rewardboolfollows globaltrue / falsePer-post override

7.4 Boundaries & conflicts

  • Front-matter reward overrides the global post.reward.enable; if omitted it follows the global setting.
  • When a QR code image is missing the popup still opens; only the image fails to load (no error).
  • Output only on post pages; standalone pages (wiki/about etc.) do not show it.

7.5 Summary

  • Minimum viable: post.reward.enable + two images.
  • Turn off for one post: front-matter reward: false.
  • Swapped image doesn’t show: clean-build first, then verify the path.

8. Print Styles

Purpose: print layout optimization for posts (hide nav/sidebar/footer, center content, show link URLs).

Learning path: Press Ctrl+P and look → confirm no config needed → boundaries

8.1 How to enable

Effect: Ctrl+P printing keeps only the body, hiding the navbar, sidebar, footer and floating buttons; full URLs appear next to links; margins and font sizes are optimized for paper and automatically switch to light variables (no black background when printing in dark mode).

Corresponding config: none needed — print styles are built into the theme CSS (source/css/_pages/_base/print.styl + the @media print rules in color-schema.styl) and are always active.

8.2 Common options

① Check with the browser print preview

Effect: the preview shows only the post body and title, filling the paper width; floating buttons and background effects all disappear.

Corresponding action:

Browser Ctrl+P → preview → confirm no sidebar / no black background → print or save as PDF

② Changing print styles

Effect: editing rules inside @media print directly changes the print result; this is a source-code change, not a config item.

Corresponding location:

themes/matery/source/css/_pages/_base/print.styl
themes/matery/source/css/color-schema.styl (@media print section)

8.3 All tunable keys

ItemLocationDefaultEffect
Print rulesprint.styl + color-schema.stylbuilt in, activeHide non-body elements, show link URLs, light variables

No YAML config key; changing styles requires editing the styl source.

8.4 Boundaries & conflicts

  • Print styles and screen styles are two rule sets; changing screen CSS does not affect print and vice versa.
  • Switching to light variables inside @media print prevents black-background white-text output when printing in dark mode.
  • Browsers disable background-color printing by default; PDF output follows the browser settings.

8.5 Summary

  • No config: built in, Ctrl+P just works.
  • Want to customize: edit print.styl, then clean-build.
  • Printing all black: confirm the @media print section in color-schema.styl is still there.

9. Music Player (APlayer)

Purpose: bottom-fixed music player on the homepage/site-wide; MetingJS resolves NetEase and other platform playlists.

Learning path: Enable the player → fill platform/type/ID → choose bottom-fixed or card → full parameters → conflicts

9.1 How to enable

Effect: a music card appears (cover + playback controls + progress bar + playlist), or a bottom-floating bar; clicking play starts the first track of the playlist.

Corresponding config (theme config music block):

music:
  enable: true            # enable (off by default)
  server: netease         # platform: netease | tencent | kugou | xiami | baidu
  type: playlist          # type: song | playlist | album | search | artist
  id: 4965675848          # playlist/song ID

9.2 Common options

① Bottom-fixed mode

Effect: with fixed: true the player stays fixed at the bottom of the page and persists while scrolling; with false it is embedded as a card in the page.

Corresponding config:

music:
  fixed: true             # true = bottom-fixed mode (floating at the bottom of the page)

② Title in non-fixed mode

Effect: card mode shows the copy from title.show at the top; in fixed mode that title is ignored.

Corresponding config:

music:
  title:
    enable: true
    show: 听听音乐

③ Autoplay and loop order

Effect: autoplay: true tries to play as soon as the page loads (browser policy may block it); loop controls single-track/playlist looping and order controls sequential or random playback.

Corresponding config:

music:
  autoplay: false
  loop: 'all'             # loop: all | one | none
  order: 'random'         # order: list | random

④ Volume, folded list, lyrics

Effect: volume sets the default volume (ignored after the user adjusts it); listFolded: true folds the playlist by default; hideLrc: true hides lyrics.

Corresponding config:

music:
  volume: 0.7             # default volume (the player remembers user settings)
  listFolded: true        # list folded by default
  hideLrc: true           # hide lyrics

⑤ Standalone music page (musics block)

Effect: a player for a separate music page; the config keys match music but are independent; fixed: false makes it an in-page card.

Corresponding config:

musics:
  enable: true
  fixed: false            # enable bottom-fixed mode
  type: playlist
  id: 4965675848

9.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
music.enableboolfalsetrue / falseWhether the player is enabled
music.title.enablebooltruetrue / falseCard title switch (only in non-fixed mode)
music.title.showstring听听音乐any stringCard title copy
music.autoHidebooltruetrue / falseWhether to auto-hide
music.serverstringneteasenetease tencent kugou xiami baiduMusic platform
music.typestringplaylistsong playlist album search artistResource type
music.idstring/number4965675848platform-specific song/playlist/album IDResource ID
music.fixedbooltruetrue / falseBottom-fixed mode
music.autoplayboolfalsetrue / falseAutoplay
music.themestring'#42b983'any CSS colorPlayer theme color
music.loopstring'all'all / one / noneLoop mode
music.orderstring'random'list / randomPlayback order
music.preloadstring'auto'none / metadata / autoPreload strategy
music.volumenumber0.70–1Default volume (ignored after user adjustment)
music.listFoldedbooltruetrue / falseList folded by default
music.hideLrcbooltruetrue / falseHide lyrics
musics.*—same as musicas aboveStandalone music page config
musics.listMaxHeightstring"525px"any CSS lengthMax list height

9.4 Boundaries & conflicts

  • music and musics are two separate configs: the former is site-wide/homepage, the latter is the standalone music page; they do not override each other.
  • title only works in non-fixed mode.
  • volume is only an initial value — the player remembers user settings, so config changes do not affect returning visitors.
  • autoplay: true is often blocked by browser autoplay policies and needs a first user interaction.

9.5 Summary

  • Minimum viable: enable + server + type + id, four items.
  • Don’t cover content: set fixed: false for card mode.
  • Volume change has no effect: clear localStorage, or verify in a private window.

10. Video Player (DPlayer)

Purpose: embed a DPlayer video player in posts, supporting local videos, HLS live streams and danmaku.

Learning path: minimal tag → add cover/danmaku → full parameters → conflicts

10.1 How to enable

Effect: a video player with playback controls (play/pause/progress/volume/speed) appears in the post, sized responsively to its container.

Corresponding config: no theme config needed — provided by the hexo-tag-mmedia plugin (DPlayer asset paths in the libs.js.dplayer config).

Example ({% mmedia %} tag; the first argument selects the player type):

{% mmedia dplayer url=/medias_webp/video/demo.mp4 %}

The example path is illustrative — replace it with your own video file (local path or remote URL).

10.2 Common options

① Cover image

Effect: the cover given by pic shows before playback and disappears after you press play.

Corresponding config:

{% mmedia dplayer url=/medias_webp/video/demo.mp4 pic=/medias_webp/featureimages/1.webp %}

② Danmaku

Effect: a danmaku input box and danmaku layer appear in the player; id + api specify the danmaku backend.

Corresponding config:

{% mmedia dplayer url=https://example.com/demo.mp4 pic=/medias_webp/featureimages/1.webp id=123456 api=https://api.prprpr.me/dplayer/v3/ %}

③ HLS live stream

Effect: when url points to a .m3u8, playback uses HLS (live/segmented stream); progress-bar behavior changes with the stream type.

Corresponding config:

{% mmedia dplayer url=https://example.com/live.m3u8 %}

10.3 All tunable keys

ParameterTypeDefaultAllowed values / rangeEffect
urlstring—video address or .m3u8Video source (required)
picstring—image path / URLCover image
idstring—any stringDanmaku pool ID
apistring—danmaku backend addressDanmaku API

The above are the dplayer parameters of hexo-tag-mmedia; the plugin supports other parameters too, other values unverified.

10.4 Boundaries & conflicts

  • Player assets are loaded by libs.js.dplayer; when missing, the tag leaves only an empty container.
  • url is required; a wrong path does not error, playback simply fails.
  • Danmaku needs id + api supplied as a pair; giving only one makes danmaku unavailable.

10.5 Summary

  • Minimum viable: the mmedia tag + one line dplayer url=.
  • Want danmaku: provide id + api together.
  • Live streaming: just change url to a .m3u8.

11. Bilibili Video Card

Purpose: embed a Bilibili video info card (cover, title, uploader, view count, duration).

Learning path: fill in the BV id → see the card → boundaries

11.1 How to enable

Effect: a Bilibili video card renders in the post with cover, title, uploader and play stats; clicking jumps to the original video.

Corresponding config: no theme config needed — provided by the hexo-bilibili-card-new plugin.

Example ({% bilicard %} tag + BV id; the API is fetched at build time to render the card):

{% bilicard BV1oa4y1L7mw %}

11.2 Common options

① Change the video

Effect: swap in another BV id and the card’s cover/title/uploader change accordingly.

Corresponding config:

{% bilicard BV1xx4y1X7xx %}

② Build-time fetch failure

Effect: when the API is unreachable the card degrades to a plain link or a blank block; the build is not interrupted.

Corresponding config: none needed; this is plugin behavior, and failure does not affect the rest of the post.

11.3 All tunable keys

ParameterTypeDefaultAllowed values / rangeEffect
BV idstring—video id starting with BVThe video to embed

Other plugin parameters unverified.

11.4 Boundaries & conflicts

  • Card data is fetched at build time; later Bilibili data changes require a rebuild to update.
  • Depends on external network access; without it the card is incomplete.
  • It is a different tag from §10’s {% mmedia %}; do not mix them up.

11.5 Summary

  • Only a BV id needed: {% bilicard BV... %}.
  • Data not updating: rebuild.
  • Slow/failed build: check external network connectivity first.

12. ECharts

Purpose: embed ECharts interactive charts in posts (bar/line/pie etc.), with zoom and tooltips.

Learning path: load the library → minimal chart → full parameters → conflicts

12.1 How to enable

Effect: an interactive chart appears in the post: hovering shows tooltips, and legends can be clicked to toggle visibility.

Corresponding config (theme config echarts block, controls chart library loading):

echarts:
  enable: true       # load the ECharts library
  version: "latest"  # library version (default v6.1.0)

Example ({% echarts %} tag; content is an ECharts option JSON; first arg is width, second is height):

{% echarts '81%' 400 %}
{
  "title": {"text": "Sample chart"},
  "xAxis": {"type": "category", "data": ["A", "B", "C"]},
  "series": [{"data": [10, 20, 30], "type": "bar"}]
}
{% endecharts %}

12.2 Common options

① Chart width and height

Effect: the first arg is width ('81%' relative to the container, '600px' also works), the second is height (pixels); the chart renders at that size.

Corresponding config:

{% echarts '81%' 400 %}

② Change the chart type

Effect: change series[].type from bar to line / pie and the matching shape renders, with unchanged interactivity.

Corresponding config:

{% echarts '81%' 400 %}
{
  "xAxis": {"type": "category", "data": ["A", "B", "C"]},
  "series": [{"data": [10, 20, 30], "type": "line"}]
}
{% endecharts %}

12.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
echarts.enablebooltruetrue / falseWhether to load the ECharts library
echarts.versionstring"latest"version number / latest (resolves to v6.1.0 by default)Library version
Tag arg 1 (width)string—CSS length or percentageChart width
Tag arg 2 (height)number—pixelsChart height
Tag contentJSON—ECharts option objectChart config

12.4 Boundaries & conflicts

  • With echarts.enable: false the library is not loaded and the tag leaves only an empty container.
  • Tag content must be valid JSON (no JS functions), otherwise parsing fails and the chart is blank.
  • Charts initialize after content injection; when used inside encrypted/dynamically inserted content, re-render via the refresh callback.

12.5 Summary

  • Two lines to load the library: enable + version.
  • Chart not showing: validate the JSON first, then confirm the library loaded.
  • Not drawn in encrypted posts: needs re-initialization after decryption.

Purpose: a breathing/flashing decorative effect for page elements.

Learning path: switch → see the effect → boundaries

13.1 How to enable

Effect: when enabled, certain elements (e.g. hint text, hr decorations) get a breathing animation with a light/dark gradient loop; disabled restores them to static.

Corresponding config (theme config):

blink:
  enable: true   # false | true

13.2 Common options

① Disable blinking

Effect: the breathing animation disappears from all elements; the page returns to static.

Corresponding config:

blink:
  enable: false

② Related: hr styling

Effect: hr dividers change from the default thin line to a theme-styled decorative line (a lightweight styling switch like blink, but independent of it).

Corresponding config:

hr:
  enable: false   # false | true

13.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
blink.enablebooltruetrue / falseBreathing blink switch
hr.enableboolfalsetrue / falsehr divider styling (related item)

13.4 Boundaries & conflicts

  • Only a switch, no speed/amplitude parameters; to tune the rhythm you must edit the styl source.
  • Unrelated to §4’s effects: this is element-level animation, not a page effect.

13.5 Summary

  • One bool: blink.enable.
  • Want to tune the rhythm: edit the source, not the config.

14. Online Customer Service (daovoice / tidio / tuxiaochao)

Purpose: three third-party online customer service/contact widgets — they don’t conflict and can run simultaneously.

Learning path: pick a platform → fill in credentials → see the entry → conflicts

14.1 How to enable

Effect: once enabled, that platform’s customer-service entry (floating bubble/button) appears at the bottom right of the page; clicking expands the chat window.

Corresponding config (DaoVoice as an example):

daovoice:
  enable: true
  app_id: your-app-id   # DaoVoice app ID

14.2 Common options

① DaoVoice

Effect: a DaoVoice floating entry appears at the bottom right; not loaded when app_id is empty.

Corresponding config:

daovoice:
  enable: false
  app_id:          # DaoVoice app ID

② Tidio

Effect: a Tidio chat bubble appears at the bottom right; public_key must be this site’s public key from the Tidio dashboard.

Corresponding config:

tidio:
  enable: false
  public_key: ki6lsd8zq8isma7plzmwzuxgpnaihind   # Tidio public key

③ Tencent Tuxiaochao

Effect: a Tuxiaochao feedback entry appears at the bottom right; clicking opens the product feedback page.

Corresponding config (see https://txc.qq.com/):

tuxiaochao:
  enable: false
  productId: 350806   # Tuxiaochao product ID

14.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
daovoice.enableboolfalsetrue / falseDaoVoice switch
daovoice.app_idstringemptyplatform app IDDaoVoice credentials
tidio.enableboolfalsetrue / falseTidio switch
tidio.public_keystringki6lsd8z...platform public keyTidio credentials
tuxiaochao.enableboolfalsetrue / falseTuxiaochao switch
tuxiaochao.productIdnumber350806platform product IDTuxiaochao credentials

14.4 Boundaries & conflicts

  • The three do not conflict and can be enabled together, but multiple entries stack at the bottom right (visually overlapping).
  • All are third-party services requiring registration on the respective platform for credentials; wrong credentials fail silently.
  • They introduce third-party scripts, affecting first paint and privacy policy — don’t enable them unless necessary.

14.5 Summary

  • Off by default; enabling one as needed is enough.
  • Don’t mistype credentials: app_id / public_key / productId each control their own platform.
  • Don’t enable all three: the entries stack on top of each other.

15. Scroll Top Arrow (scroll_top_arrow)

Purpose: a one-click back-to-top arrow button in the bottom-right corner.

Learning path: switch → distinguish from §6 → boundaries

15.1 How to enable

Effect: a standalone up-arrow button appears at the bottom right; clicking smoothly returns to the top; it is a separate entry from §6’s #backTop.

Corresponding config (theme config):

scroll_top_arrow:
  enable: true

15.2 Common options

① Disable the arrow

Effect: the standalone arrow disappears; if #backTop still exists, back-to-top capability is unaffected.

Corresponding config:

scroll_top_arrow:
  enable: false

15.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
scroll_top_arrow.enablebooltruetrue / falseStandalone back-to-top arrow switch

15.4 Boundaries & conflicts

  • A separate entry from §6’s #backTop floating button; this config only controls the standalone arrow, shown when enable: true.
  • With both enabled, two back-to-top controls may appear at the bottom right; turn one off based on visual preference.
  • No position/color parameters; changing styles requires editing styl.

15.5 Summary

  • One bool: scroll_top_arrow.enable.
  • Two back-to-top buttons: keep just one.

16. Page Background (background)

Purpose: site-wide page background — image background (optionally random) or video background, plus a loading animation. This is a separate mechanism from the §4 effects page effects.

Learning path: enable the master switch → choose the default mode → configure the random image library → configure video → configure the loading animation → full parameters → conflicts

16.1 How to enable

Effect: the selected background (image or video) appears beneath the page, with cards optionally semi-transparent above it; the loading animation plays a transition on first entry.

Corresponding config (theme config):

background:
  enable: true        # master switch: false renders neither image nor video background
  default: off        # default background when the panel is unset: image | video | off

16.2 Common options

① Image background (including random library)

Effect: with random: true, one image is picked randomly from lightPath / darkPath per light/dark theme (counts given by lightNum / darkNum); with false the fixed url is used.

Corresponding config:

background:
  image:
    enable: true
    url: "{mediaUrl}/medias_webp/sea.webp"   # default background on first visit
    random: true        # random background: pick one from the light/dark libraries
    lightNum: 45        # number of light random images (0-based)
    lightPath: /medias_webp/featureimages/   # light library path
    darkNum: 22         # number of dark random images (0-based)
    darkPath: /medias_webp/featureimages/dark/  # dark library path

② Video background

Effect: randomly plays a video from the JSON list at url, overlaid with the cover; brightness decides whether that video suits the light or dark theme.

Corresponding config:

background:
  video:
    enable: true
    url: /video_url.json?v=1.0.0   # video list JSON (local static file)
                                   # structure [{video: webmURL, cover: webpURL, brightness: bright|dark}]

③ Loading animation

Effect: on first entry the chosen transition animation plays (1 pacman / 2 blocks / 3 circles); time is the forced duration (ms), off disables it.

Corresponding config:

background:
  loading:
    enable: true
    type: "off"         # default type: off disabled | 1 pacman | 2 blocks | 3 circles
    time: 350           # forced duration ms (1000=1s)

④ Runtime switching (reader side)

Effect: the panel’s “Page Background” picks off / image / video and “Loading Animation” picks off / 1 / 2 / 3; the choice is written to localStorage and takes effect after refresh, with higher priority than background.default.

Corresponding call (equivalent to the panel operation):

localStorage.setItem('matery.bg', 'image');      // enable the image background after refresh
localStorage.setItem('matery.loading', '2');     // play the blocks loading animation after refresh
localStorage.removeItem('matery.bg');            // clear the preference → fall back to background.default

16.3 All tunable keys

KeyTypeDefaultAllowed values / rangeEffect
background.enablebooltruetrue / falseBackground master switch
background.defaultstringoffoff / image / videoDefault background mode with no local preference
background.image.enablebooltruetrue / falseImage background switch
background.image.urlstring{mediaUrl}/medias_webp/sea.webpimage path / URLDefault background image
background.image.randombooltruetrue / falseWhether to pick images randomly
background.image.lightNumnumber45non-negative integerNumber of light random images
background.image.lightPathstring/medias_webp/featureimages/directory pathLight library path
background.image.darkNumnumber22non-negative integerNumber of dark random images
background.image.darkPathstring/medias_webp/featureimages/dark/directory pathDark library path
background.video.enablebooltruetrue / falseVideo background switch
background.video.urlstring/video_url.json?v=1.0.0JSON pathVideo list address
background.loading.enablebooltruetrue / falseLoading animation switch
background.loading.typestring"off"off / 1 / 2 / 3Default animation type
background.loading.timenumber350msForced duration
localStorage["matery.bg"]string—off / image / videoRuntime background preference
localStorage["matery.loading"]string—off / 1 / 2 / 3Runtime loading-animation preference

16.4 Boundaries & conflicts

  • Switch hierarchy is background.enable (master) → each sub enable → panel selection; turning off any level stops rendering.
  • With random: true, images are picked from lightPath / darkPath libraries by light/dark theme; lightNum / darkNum are the available image counts (0-based).
  • The video background’s brightness field is filtered by theme (cover grayscale ≥90 = bright / <90 = dark).
  • Image and video are mutually exclusive (the panel’s matery.bg is single-select); the loading animation is a separate single-select.
  • This is a different mechanism from §4 effects: background controls the underlying canvas, effects control falling/click animations.

16.5 Summary

  • Minimum viable: background.enable + default: image.
  • Change the image every time: random: true + library paths and counts.
  • Want to turn off the background area: background.enable: false (the corresponding panel area disappears too).

17. Preference Panel (right-floating)

Purpose: the gear button (#fp-toggle) in the bottom-right floating button group opens a “Preference Settings” panel, letting readers adjust reading preferences without touching code. The panel itself is always visible; the “Effects” and “Background” areas are shown/hidden by effects.enable / background.enable.

Learning path: font scaling → language/trad-simp → display mode → effects and background → section overview

17.1 How to enable

Effect: a gear button appears at the bottom right; clicking expands a panel with seven sections — font scaling, language/trad-simp, display mode, page effects, mouse effects, page background, loading animation; all choices persist across pages.

Corresponding config: the panel itself is always visible, with no YAML master switch; the “Effects” area is controlled by effects.enable and the “Background” area by background.enable.

effects:
  enable: true       # false → the panel's "page effects/mouse effects" area disappears
background:
  enable: true      # false → the panel's "page background/loading animation" area disappears

17.2 Common options

① Font scaling

Effect: A− / A+ / Reset adjust in 0.1 steps (range 0.85–1.3); all rem-based font sizes scale proportionally site-wide and trigger a layout reflow; the choice is written to localStorage matery.font-scale.

Corresponding call (equivalent to clicking the buttons):

document.documentElement.style.setProperty('--font-scale', '1.2');  // site-wide font size ×1.2
localStorage.setItem('matery.font-scale', '1.2');                   // persists after refresh

② Language / trad-simp

Effect: the language dropdown switches the site language; the “Simp/Trad” segmented control uses the same mechanism as §5 (cookie + body conversion), and the body changes immediately after switching.

Corresponding call:

Matery.plugins.languageToggle();               // simp ↔ trad
Matery.plugins.languageToggle.getEncoding();   // current encoding

③ Display mode

Effect: light / auto / dark single-select, reusing color-schema.js storage and the data-user-color-scheme attribute; the switch applies immediately and persists across refresh; choosing “auto” clears the local choice and returns to prefers-color-scheme.

Corresponding call:

document.documentElement.setAttribute('data-user-color-scheme', 'dark');
localStorage.setItem('Matery_Color_Scheme', 'dark');   // persists after refresh
document.documentElement.removeAttribute('data-user-color-scheme');  // back to auto

④ Page effects / Mouse effects

Effect: each offers Off / Random / a specific effect; the choice is written to localStorage and applies after refresh (see §4).

Corresponding config:

localStorage.setItem('matery.effect.page', 'sakura');
localStorage.setItem('matery.effect.mouse', 'clicklove');

⑤ Page background / Loading animation

Effect: background off / image / video single-select; loading animation off / 1 / 2 / 3 single-select (see §16).

Corresponding config:

localStorage.setItem('matery.bg', 'image');
localStorage.setItem('matery.loading', '2');

17.3 All tunable keys

SectionStorage key / config keyValueEffect
Font scalinglocalStorage["matery.font-scale"]0.85–1.3, step 0.1Site-wide font scale (CSS variable --font-scale)
Languagepreference.default_lang / preference.lang_metasee Installation & Theme ConfigSite-wide language dropdown
Trad-simppreference.translate.enable + buttontrue / falseTrad/simp conversion (§5)
Display modelocalStorage["Matery_Color_Scheme"]light / dark / autoLight/dark theme
Page effectslocalStorage["matery.effect.page"]off / random / idPage decoration (§4)
Mouse effectslocalStorage["matery.effect.mouse"]off / random / idClick decoration (§4)
Page backgroundlocalStorage["matery.bg"]off / image / videoBackground mode (§16)
Loading animationlocalStorage["matery.loading"]off / 1 / 2 / 3Transition animation (§16)

17.4 Boundaries & conflicts

  • The panel itself is always visible; only the “Effects” and “Background” areas are shown/hidden by effects.enable / background.enable.
  • Font scaling changes --font-scale on <html>; root font size = calc(--font-size-base × --font-scale) (default 16px × 1); styles hardcoded in px do not scale.
  • Display mode shares the same localStorage key as color-schema.js; both entries (menu button / panel) stay in sync.
  • Files involved: template themes/matery/layout/_partial/common/right-floating.ejs; font-size variables in themes/matery/source/css/_pages/_base/base.styl and color-schema.styl.

17.5 Summary

  • Reader self-service: for most preference issues, have readers adjust the panel rather than editing config.
  • Two areas can be hidden: turning off effects.enable / background.enable removes them from the panel.
  • Direct storage access: all preferences live in localStorage; clearing it falls back to config defaults.

Appendix: Interaction & Visual Feature Quick Reference

FeatureConfig locationKey paramsDescription
Code block enhancementtheme codeshrink/break/show_full/copy_btn/languagelanguage label + copy/expand/fullscreen
Image lightboxtheme post.image_zoomenable/img_url_replacepost images auto-wrapped .img-item
Typewritertheme subtitle.typed / fun_features.typing / post.typedloop/showCursor/typeSpeedsubtitle rotation + post titles
Page effectstheme effectspage/mouse 9/4 items, default: off/random/idruntime switching via floating panel
Trad/Simp conversiontheme preference.translateenablemigrated here (old footer.translate removed)
Progress bartheme fun_features.progressbarheight_px/coloroff by default
Back to topbuilt-in (right floating panel)no config key#backTop enabled by default
Rewardtheme post.rewardwechat/alipay QR imagesper-post override via front-matter reward
Print stylesbuilt-in CSS (print.styl)no config key@media print auto-applies
Music APlayertheme music / musicsserver/type/id/fixedMetingJS parsing, bottom-fixed option
Video DPlayernpm plugin hexo-tag-mmediaurl/pic/id/api{% mmedia dplayer %}
Bilibili cardnpm plugin hexo-bilibili-card-newBV id{% bilicard BV... %}
EChartstheme built-in tag pluginenable/version{% echarts %} JSON config
Comments
Data Loading...