Loading...

Loading...

Navigation Menu & Homepage

This page explains the configuration of the top navigation menu (level-1/level-2 menus) and the homepage (cover carousel, banner, post waterfall). Everything is done in the theme config.

The authoritative source of the theme config is userConfig/_config.tmp.yml (it overwrites the theme config at CI time); all sections below come from it.

Reading guide: every section follows 「How to enable → Common options → All tunable keys → Boundaries & conflicts」 — check the Effect first, then the Corresponding config that produces it, and copy it to use.

1. Navigation Menu (menu)

Purpose: menu items in the top navbar. Supports level-1 menus (direct links) and level-2 menus (children dropdowns).

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

1.1 How to enable

Effect: menu items appear in the top bar of the page; hovering an item with children opens a dropdown panel, and clicking navigates to the matching URL.

Corresponding config (theme config, menu section):

menu:
  home:                         # level-1 menu: direct link
    url: /                      # level-1 menus must have url (can omit when children exist)
    icon: fas fa-home           # Font Awesome icon (v5.15 icon names)
    class: menu-2d-home         # live2d selector: positions the tooltip box
  nav:
    url: https://nav.17lai.site/
    icon: fas fa-suitcase
    class: menu-2d-nav
    target: _blank              # open in a new tab
  so:
    url: https://so.17lai.site/
    icon: fas fa-mask
    class: menu-2d-sosuo
    target: _blank
  multimedia:                   # level-2 menu: children array
    icon: fas fa-music
    class: menu-2d-media
    children:
      - name: music             # menu display name (i18n key)
        url: /musics/
        icon: fas fa-music
        class: menu-2d-musics
      - name: gallery
        url: /galleries/
        icon: fas fa-image
      - name: movie
        url: /movies/
        icon: fas fa-film
  posts:
    icon: fas fa-folder-plus
    children:
      - name: tags              # /tags/ tag page
        url: /tags/
        icon: fas fa-tags
      - name: categories        # /categories/ category page
        url: /categories/
        icon: fas fa-bookmark
      - name: archives          # /archives/ archive page
        url: /archives/
        icon: fas fa-archive

1.2 Common options

① Add a level-1 menu

Effect: an extra icon menu item appears in the top bar; clicking it jumps directly to that URL.

Corresponding config:

menu:
  about:
    url: /about/
    icon: fas fa-user

② Add a level-2 menu

Effect: the menu becomes a dropdown panel whose children open on hover.

Corresponding config:

menu:
  posts:
    icon: fas fa-folder-plus
    children:
      - name: tags
        url: /tags/
        icon: fas fa-tags

③ Open an external link in a new window

Effect: clicking opens a new tab instead of leaving the site.

Corresponding config:

menu:
  nav:
    url: https://nav.17lai.site/
    target: _blank

1.3 All tunable keys

KeyTypeDefaultAllowed values / rangeDescription
menu.<name>.urlstring—absolute site path or full URLLevel-1 menu link (required for level-1)
menu.<name>.iconstring—Font Awesome v5.15 icon classMenu icon
menu.<name>.classstring—any class namelive2d tooltip positioning selector
menu.<name>.targetstring—_blank / _selfHow the link opens
menu.<name>.childrenarray—array of child itemsLevel-2 menu
menu.<name>.children[].namestring—i18n keyChild menu display name
menu.<name>.children[].urlstring—site path or URLChild menu link
menu.<name>.children[].iconstring—Font Awesome classChild menu icon
menu.<name>.children[].classstring—any class namelive2d positioning selector

1.4 Boundaries & conflicts

  • Adding a menu: add an entry under menu (level-1) or add children to a menu (level-2). name is an i18n key (the matching copy in languages/zh-CN.yml); look up icon in Font Awesome v5.15; target: _blank opens external links in a new window.
  • class is only for positioning the live2d mascot tooltip; omit it if you have no mascot.
  • Write menu url as /musics/ (absolute path), not musics, otherwise concatenation with url may break.

1.5 Summary

  • Minimal setup: one url + icon is a level-1 menu
  • Want a dropdown: switch to children; the parent can omit url
  • External links: remember target: _blank
  • No relative paths: /xxx/ rather than xxx

Purpose: the cover carousel of posts at the top of the homepage. Posts enter the carousel via cover/coverImg in front-matter.

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

2.1 How to enable

Effect: a large-image carousel appears at the top of the homepage; you can switch with the left/right buttons and the bottom dots, it auto-rotates every intervalTime, and clicking an image opens the corresponding post.

Corresponding config (theme config, cover section):

cover:
  showPrevNext: true    # prev/next buttons
  showIndicators: true  # bottom indicators (dots)
  autoLoop: true        # auto rotation
  duration: 180         # transition duration (ms)
  intervalTime: 8000    # auto rotation interval (ms)
  useConfig: false      # true = use _data/covers.json for carousel posts
  video:
    enable: false       # carousel background video (fill src with an array of video URLs)
    src:
      - https://example.com/video1.mp4

2.2 Common options

① Put a post into the carousel

Effect: that post’s cover appears in the carousel.

Corresponding config (post front-matter):

cover: true

② Change the carousel image

Effect: the post uses the specified image in the carousel instead of its default cover.

Corresponding config (post front-matter):

coverImg: /path/to/img.webp

③ Turn off auto rotation

Effect: manual switching only; it no longer advances every few seconds.

Corresponding config:

cover:
  autoLoop: false

④ Configure everything through a data file

Effect: carousel contents are decided by source/_data/covers.json; post front-matter is ignored.

Corresponding config:

cover:
  useConfig: true

Post front-matter control (priority notes from the config comments):

front-matter keyEffect
hide: truefully hide the post (not in the homepage list, not in the cover carousel)
cover: truepost enters the cover carousel (prerequisite: hide is not true)
coverImg: /path/to/img.webpcustom carousel image (takes priority over the cover default)

Priority: hide: true > cover: true. hide: true + cover: true → the post is fully hidden, not in the carousel.

2.3 All tunable keys

KeyTypeDefaultAllowed values / rangeDescription
cover.showPrevNextbooltruetrue / falsePrev/next buttons
cover.showIndicatorsbooltruetrue / falseBottom indicators
cover.autoLoopbooltruetrue / falseAuto rotation
cover.durationnumber180millisecondsTransition duration
cover.intervalTimenumber8000millisecondsAuto rotation interval
cover.useConfigboolfalsetrue / falseUse _data/covers.json
cover.video.enableboolfalsetrue / falseCarousel background video
cover.video.srcarray—array of video URLsBackground video sources
front-matter hidebool—trueFully hide the post
front-matter coverbool—trueEnter the carousel
front-matter coverImgstring—image pathCustom carousel image

2.4 Boundaries & conflicts

  • With useConfig: true, the post front-matter cover/coverImg stop working; _data/covers.json decides instead.
  • hide: true has the highest priority; cover: true has no effect.
  • With video.enable: true the carousel background plays a video; if src is empty nothing shows.

2.5 Summary

  • Minimal setup: post front-matter cover: true
  • Want a different image: add coverImg
  • Hide one post: hide: true, an absolute veto
  • Centralized control: useConfig: true + covers.json

3. Homepage Banner & Subtitle

Purpose: the homepage hero image (independent of the global banner), the typewriter subtitle, buttons and social links, and the “dream” quote.

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

3.1 How to enable

Effect: a full-screen banner at the top of the homepage (100% viewport height by default), with a 30% black mask over the image, a subtitle typed out character by character below the title, and a row of social icons on the right.

Corresponding config (theme config, index section):

index:
  banner_img: /img/default.png   # homepage hero image (relative or absolute path)
  banner_img_height: 100         # hero image height (percentage of screen, 0-100)
  banner_mask_alpha: 0.3         # black mask opacity (0-1, 1 = fully opaque)
  slogan:                        # homepage subtitle, configured independently
    enable: true
    text: "An elegant Material-Design theme for Hexo"  # empty = use hexo subtitle
    api:                         # fetch the subtitle via API (returns JSON)
      enable: false
      url: ""
      method: "GET"              # GET | POST | PUT
      headers: {}
      keys: []                   # value path, e.g. ['data','content']

3.2 Common options

① Change the homepage hero image

Effect: the homepage banner switches to the specified image (homepage only, post pages unaffected).

Corresponding config:

index:
  banner_img: /medias_webp/banner/home.webp

② Adjust the banner height

Effect: 100 fills the whole screen, 50 keeps only half.

Corresponding config:

index:
  banner_img_height: 50

③ Change the subtitle

Effect: the typewriter text becomes the new string; if text is empty it falls back to the site subtitle.

Corresponding config:

index:
  slogan:
    enable: true
    text: "Think deeply, live deeply"

④ Provide the subtitle via API

Effect: the subtitle comes from a JSON field returned by the endpoint; on request failure it falls back to text.

Corresponding config:

index:
  slogan:
    api:
      enable: true
      url: "https://example.com/slogan.json"
      method: "GET"
      keys: ['data', 'content']

Homepage-only widgets:

dream:               # "dream" quote (text below the banner)
  enable: true
  showTitle: false
  title: Dream
  text: "All that I have lost was never mine…"

indexbtn:            # second banner button
  enable: true
  name: GitHub
  icon: fab fa-github
  url: https://github.com/appotry

socialLink:          # personal info row in the banner (leave empty to hide)
  github: https://github.com/appotry
  dockerhub: https://hub.docker.com/u/bloodstar
  email: admin@17lai.fun
  rss: true          # true/false

3.3 All tunable keys

KeyTypeDefaultAllowed values / rangeDescription
index.banner_imgstring—image path or URLHomepage hero image
index.banner_img_heightnumber1000–100 (percentage of viewport)Hero image height
index.banner_mask_alphanumber0.30–1Black mask opacity
index.slogan.enablebooltruetrue / falseSubtitle switch
index.slogan.textstring—any stringSubtitle text (empty = site subtitle)
index.slogan.api.enableboolfalsetrue / falseFetch subtitle via API
index.slogan.api.urlstring""URLEndpoint address
index.slogan.api.methodstring"GET"GET / POST / PUTRequest method
index.slogan.api.headersmap{}request headersCustom request headers
index.slogan.api.keysarray[]array of field pathsValue path
dream.enablebooltruetrue / falseQuote switch
dream.showTitleboolfalsetrue / falseWhether to show the quote title
dream.titlestring—any stringQuote title
dream.textstring—any stringQuote content
indexbtn.enablebooltruetrue / falseSecond button switch
indexbtn.namestring—any stringButton label
indexbtn.iconstring—Font Awesome classButton icon
indexbtn.urlstring—URLButton link
socialLink.<platform>string—URL or emptySocial icon link (empty = hidden)
socialLink.rssbool—true / falseRSS icon

3.4 Boundaries & conflicts

  • index.banner_* applies to the homepage only; for the post-page hero image see post.banner_* in the “Post Page Configuration” chapter.
  • slogan.api depends on the typewriter effect (fun_features.typing.enable); when that is off the API subtitle does not show.
  • Platforms left empty in socialLink render no icon; rss: true/false is a switch, not a link.
  • With dream.showTitle: false only text is shown.

3.5 Summary

  • Minimal setup: banner_img + slogan.text
  • Want it minimal: lower banner_mask_alpha + disable dream
  • No subtitle text: leave it empty to use the site subtitle
  • API subtitle not working: enable the typewriter effect first

4. Homepage Post List (Waterfall)

Purpose: the homepage content area shows post cards in a waterfall (Masonry) layout. The layout is handled by the theme; config controls excerpts, link target, meta info and pinning.

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

4.1 How to enable

Effect: multi-column post cards appear below the homepage banner, each showing cover, title, date/category/tags; scrolling to the bottom loads the next page automatically.

Corresponding config (theme config, inside the index section):

index:
  auto_excerpt:
    enable: true              # auto-extract post excerpts
  post_url_target: _self      # open posts: _blank new tab | _self same page
  post_meta:                  # post card meta info
    date: true
    category: true
    tag: true
  post_sticky:                # icon before pinned post titles
    enable: true
    icon: "iconfont icon-top"

4.2 Common options

① Auto excerpt

Effect: cards show the first characters of the body instead of just the title.

Corresponding config:

index:
  auto_excerpt:
    enable: true

② Open posts in a new tab

Effect: clicking a card opens it in a new tab.

Corresponding config:

index:
  post_url_target: _blank

③ Card meta info

Effect: show/hide date, category and tags on cards.

Corresponding config:

index:
  post_meta:
    date: true
    category: true
    tag: false

④ Pin a post

Effect: posts with a larger sticky value rank first, with a pin icon before the title.

Corresponding config (post front-matter):

sticky: 1

Post front-matter controls the card:

title: Example post
sticky: 1          # larger = higher (homepage pin)
index_img: /medias_webp/cover/5w2h.webp   # card cover image
hide: false        # true = hidden from the homepage list

4.3 All tunable keys

KeyTypeDefaultAllowed values / rangeDescription
index.auto_excerpt.enablebooltruetrue / falseAuto-extract excerpts
index.post_url_targetstring_self_blank / _selfHow posts open
index.post_meta.datebooltruetrue / falseShow date on cards
index.post_meta.categorybooltruetrue / falseShow category on cards
index.post_meta.tagbooltruetrue / falseShow tags on cards
index.post_sticky.enablebooltruetrue / falsePin icon switch
index.post_sticky.iconstring—icon classPin icon
front-matter stickynumber—positive integer, larger = higherHomepage pin weight
front-matter index_imgstringpost.default_index_imgimage pathCard cover
front-matter hideboolfalsetrue / falseHidden from the homepage list

4.4 Boundaries & conflicts

  • Without index_img, the theme config post.default_index_img is the fallback (see the “Post Page Configuration” chapter); if both are empty no cover shows.
  • The waterfall layout is based on the Masonry library; it reflows automatically after images load — no manual maintenance.
  • hide: true affects both the homepage list and the cover carousel (see §2).

4.5 Summary

  • Minimal setup: nothing to configure; the waterfall is the default
  • Cards too plain: enable auto_excerpt + set index_img
  • Want to pin: front-matter sticky: 1
  • One post shouldn’t appear: hide: true

Appendix: Navigation & Homepage Quick Reference

FeatureConfig locationDescription
Nav menutheme menulevel-1 url/icon/class/target, level-2 children
Cover carouseltheme coverauto rotation + indicators; front-matter cover/coverImg/hide
Homepage bannertheme indexbanner_img/height/mask + slogan subtitle
Dream quotetheme dreamquote text below the banner
Homepage buttontheme indexbtnsecond button (name/icon/link)
Social linkstheme socialLinksecond-row icons, hidden when empty
Post listtheme index + front-matterexcerpt/link target/meta/pin/cover
Comments
Data Loading...