XPoet / hexo-theme-keep

:rainbow: A simple and light theme for Hexo. It makes you more focused on writing.
https://xpoet.cn
GNU Affero General Public License v3.0
1.35k stars 183 forks source link

不打开图片懒加载配置,会报错。导致搜索功能无法使用 #356

Closed lyjsly closed 3 months ago

lyjsly commented 3 months ago

Issue Checklist | Issue 检查清单

Expected behavior | 预期行为

image

Actual behavior | 实际行为

Steps to reproduce the behavior | 重现步骤

1.开启搜索功能。hexo安装插件,主题配置启用。此时懒加载功能是false 2.打开博客使用搜索功能,发现页面报错。 3.打开图片懒加载功能后,搜索功能可以用了。(报错导致的蝴蝶效应?)

Node.js and NPM Information | Node.js 和 NPM 信息

v16.19.0
8.19.3

Hexo Configuration | Hexo 配置

## ======================================================================================
## Hexo Theme Keep
## Documents: https://keep-docs.xpoet.cn
## Repository: https://github.com/XPoet/hexo-theme-keep
## ======================================================================================

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html
# ---------------------------------------------------------------------------------------
base_info:
  # Theme primary color
  primary_color: "#0066cc"

  # Blog website title
  title: 晓昊 小站

  # Blog website author name
  author: 晓昊

  # Author avatar, You can use local image path or image link
  avatar: /images/logo.png

  # Website LOGO, You can use local image path or image link
  logo: /images/logo.png

  # Website favicon, You can use local image path or image link
  favicon: /images/logo.svg

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/menu.html
# ---------------------------------------------------------------------------------------
# If you want to enable a new navigation menu, you need to create a corresponding page
# e.g. to enable categories, you need to execute `hexo new page categories`
# Use `||` to set icon for navigation menu, e.g. `home: / || fa-solid fa-home`
menu:
  home: /                       || fa-solid fa-home
  archives: /archives           || fa-solid fa-box-archive
  tags: /tags                   || fa-solid fa-tags
  categories: /categories       || fa-solid fa-layer-group
  # links: /links               # || fa-solid fa-link
  # photos: /photos             # || fa-solid fa-image
  # tools: /tools               # || fa-solid fa-tools
  about: /about                 || fa-solid fa-address-card
  工具: /工具
  # ......

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/first_screen.html
# ---------------------------------------------------------------------------------------
first_screen:
  enable: false  # Option values: true | false

  # First screen background image in light mode, You can use local image path or image link
  background_img: /images/bg.svg

  # First screen background image in dark mode, You can use local image path or image link
  background_img_dark: /images/bg.svg

  # First screen description
  # You can use the "||" to begin a newline, maximum is two lines.
  description: 任何事情其实都没有那么难,去积累吧

  # If enable hitokoto, first screen description is different every time when you enter the website
  hitokoto: false      # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/social_contact.html
# ---------------------------------------------------------------------------------------
social_contact:
  enable: false      # Option values: true | false
  links:
    # Fill in your social platform links here, e.g. `github: https://github.com/XPoet`
    # If you want to click open the picture, you need to add a prefix `img | `,
    # at the same time change your link to the image link.
    # e.g. `weixin: img | ./images/qrcode.png`
    github:          # GitHub
    weixin:          # WeChat
    qq:              # QQ
    weibo:           # WeiBo
    zhihu:           # ZhiHu
    twitter:         # Twitter
    x:               # X
    facebook:        # Facebook
    email:           # Email

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/scroll.html
# ---------------------------------------------------------------------------------------
scroll:
  # Show progress bar in top when page scroll
  progress_bar: false  # Option values: true | false

  # Show percent when page scroll
  percent: false       # Option values: true | false

  # Hide header in top when page scroll
  hide_header: true    # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/home.html
# ---------------------------------------------------------------------------------------
home:
  # Website announcement in home page
  announcement:

  # Show category in home page post block
  category: true           # Option values: true | false

  # Show tags in home page post block
  tag: true                # Option values: true | false

  # Set the datetime type of home page post block
  post_datetime: created    # Option values: updated | created

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/post.html
# ---------------------------------------------------------------------------------------
post:
  # Author badge in the post
  author_badge:
    enable: true         # Option values: true | false

    # If true, show Lv1, Lv2, Lv3 ...
    # If false, show custom badge
    level_badge: true    # Option values: true | false

    # Custom badge array, You can be fill one or more item
    custom_badge: ["One", "Two", "Three"]

  # Post word count
  # Depend on Hexo Plugin: hexo-wordcount (`npm install hexo-wordcount`)
  # See: https://github.com/willin/hexo-wordcount
  word_count:
    wordcount: false     # Word count, one post. Option values: true | false
    min2read: false      # Time to read, one post. Option values: true | false

  # Post datetime
  datetime_format: "YYYY-MM-DD HH:mm:ss"  # Datetime format. e.g. "YYYY-MM-DD HH:mm:ss"

  # Post copyright info
  copyright_info: false  # Option values: true | false

  # Post share
  share: false           # Option values: true | false

  # Reward author
  reward:
    enable: false        # Option values: true | false
    img_link:            # Image link for the payment QR code
    text:                # Custom reward text, Can be null
    icon:                # Custom reward icon, Can be null

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/code_block.html
# ---------------------------------------------------------------------------------------
code_block:
  # Toolbar include: "code copy", "code block collapse" and "code language"
  tools:
    enable: false            # Option values: true | false
    style: default           # Option values: default | mac
  highlight_theme: default   # Option values: default | obsidian

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/toc.html
# ---------------------------------------------------------------------------------------
toc:
  enable: false      # Option values: true | false

  # Automatically add list number to toc
  number: false      # Option values: true | false

  # If true, all level of TOC in a post will be displayed, rather than the activated part of it.
  expand_all: false  # Option values: true | false

  # If true, auto open TOC every time when you enter post page
  init_open: true    # Option values: true | false

  # TOC layout on post page
  layout: right      # Option values: left | right

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/website_count.html
# ---------------------------------------------------------------------------------------
website_count:
  # busuanzi
  # See: http://ibruce.info/2015/04/04/busuanzi/
  busuanzi_count:
    enable: false     # Option values: true | false
    site_uv: false    # Option values: true | false
    site_pv: false    # Option values: true | false
    page_pv: false    # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/local_search.html
# Depend on Hexo Plugin: hexo-generator-searchdb (`npm install hexo-generator-searchdb`)
# See: https://github.com/theme-next/hexo-generator-searchdb
# ---------------------------------------------------------------------------------------
local_search:
  enable: true   # Option values: true | false
  preload: false  # Preload the search data when the page loads. Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/comment.html
# ---------------------------------------------------------------------------------------
comment:
  enable: false   # Option values: true | false
  use: valine     # Option values: valine | gitalk | twikoo | waline | giscus | artalk | disqus

  # Valine
  # See: https://github.com/xCss/Valine
  #      https://valine.js.org
  valine:
    appid:           # Your leancloud application appid
    appkey:          # Your leancloud application appkey
    server_urls:     # Your Server URL
    placeholder:     # Input box placeholder

  # Gitalk
  # See: https://github.com/gitalk/gitalk
  #      https://gitalk.github.io
  gitalk:
    github_id:        # GitHub repo owner
    github_admins:    # GitHub Admins (in Array type), optional
    repository:       # Repository name to store issues
    client_id:        # GitHub Application Client ID
    client_secret:    # GitHub Application Client Secret
    proxy:            # GitHub oauth request reverse proxy for CORS

  # Twikoo
  # See: https://github.com/imaegoo/twikoo
  #      https://twikoo.js.org
  twikoo:
    env_id:          # Environment ID
    region:          # Environment region, Can be null
    version: 1.6.36  # Twikoo version, default use v1.6.36

  # Waline
  # See: https://github.com/walinejs/waline
  #      https://waline.js.org/guide/get-started.html
  waline:
    server_url:         # Server URL
    reaction: false     # Post reactions, option values: true | false
    version: 3.2.1      # Waline version, default use v3.2.1

  # Giscus
  # See: https://github.com/giscus/giscus
  #      https://giscus.app
  # Please generate your configuration items in https://giscus.app
  giscus:
    repo:
    repo_id:
    category: Announcements    # Recommend use Announcements
    category_id:
    reactions_enabled: false   # Option values: true | false

  # Artalk
  # See: https://github.com/ArtalkJS/Artalk
  #      https://artalk.js.org
  artalk:
    server:                    # Server URL

  # Disqus
  # See: https://disqus.com/
  disqus:
    shortname:                 # Disqus Shortname

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/rss.html
# Depend on Hexo Plugin: hexo-generator-feed (`npm install hexo-generator-feed`)
# See: https://github.com/hexojs/hexo-generator-feed
# ---------------------------------------------------------------------------------------
rss:
  enable: false  # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/lazyload.html
# ---------------------------------------------------------------------------------------
lazyload:
  enable: false  # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/cdn.html
# ---------------------------------------------------------------------------------------
cdn:
  enable: false       # Option values: true | false
  provider: cdnjs     # Option values: cdnjs | jsdelivr | unpkg

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/pjax.html
# ---------------------------------------------------------------------------------------
pjax:
  enable: false  # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/footer.html
# ---------------------------------------------------------------------------------------
footer:
  since: 2020            # The starting year of your website, Can be null
  word_count: false      # Option values: true | false

  site_deploy:
    enable: false        # Option values: true | false
    provider: github     # Option values: github | vercel | netlify | cloudflare | gitee | aliyun | tencent_cloud | upyun
    url:                 # Your deployment provider url, Can be null

  record:
    enable: false        # Option values: true | false
    list:
      - code:            # record code of your website
        link:            # record link of your website, Can be null
      # e.g.
      # - code: ICP 001
      # - link: https://beian.miit.gov.cn

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/inject.html
# ---------------------------------------------------------------------------------------
inject:
  enable: false  # Option values: true | false
  css:
    -
    # e.g.
    # - /css/custom-1.css
    # - /css/custom-2.css
    # - ...
  js:
    -
    # e.g.
    # - /js/custom-1.js
    # - /js/custom-2.js
    # - ...

Keep Configuration | Keep 配置

## ======================================================================================
## Hexo Theme Keep
## Documents: https://keep-docs.xpoet.cn
## Repository: https://github.com/XPoet/hexo-theme-keep
## ======================================================================================

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html
# ---------------------------------------------------------------------------------------
base_info:
  # Theme primary color
  primary_color: "#0066cc"

  # Blog website title
  title: 晓昊 小站

  # Blog website author name
  author: 晓昊

  # Author avatar, You can use local image path or image link
  avatar: /images/logo.png

  # Website LOGO, You can use local image path or image link
  logo: /images/logo.png

  # Website favicon, You can use local image path or image link
  favicon: /images/logo.svg

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/menu.html
# ---------------------------------------------------------------------------------------
# If you want to enable a new navigation menu, you need to create a corresponding page
# e.g. to enable categories, you need to execute `hexo new page categories`
# Use `||` to set icon for navigation menu, e.g. `home: / || fa-solid fa-home`
menu:
  home: /                       || fa-solid fa-home
  archives: /archives           || fa-solid fa-box-archive
  tags: /tags                   || fa-solid fa-tags
  categories: /categories       || fa-solid fa-layer-group
  # links: /links               # || fa-solid fa-link
  # photos: /photos             # || fa-solid fa-image
  # tools: /tools               # || fa-solid fa-tools
  about: /about                 || fa-solid fa-address-card
  工具: /工具
  # ......

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/first_screen.html
# ---------------------------------------------------------------------------------------
first_screen:
  enable: false  # Option values: true | false

  # First screen background image in light mode, You can use local image path or image link
  background_img: /images/bg.svg

  # First screen background image in dark mode, You can use local image path or image link
  background_img_dark: /images/bg.svg

  # First screen description
  # You can use the "||" to begin a newline, maximum is two lines.
  description: 任何事情其实都没有那么难,去积累吧

  # If enable hitokoto, first screen description is different every time when you enter the website
  hitokoto: false      # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/social_contact.html
# ---------------------------------------------------------------------------------------
social_contact:
  enable: false      # Option values: true | false
  links:
    # Fill in your social platform links here, e.g. `github: https://github.com/XPoet`
    # If you want to click open the picture, you need to add a prefix `img | `,
    # at the same time change your link to the image link.
    # e.g. `weixin: img | ./images/qrcode.png`
    github:          # GitHub
    weixin:          # WeChat
    qq:              # QQ
    weibo:           # WeiBo
    zhihu:           # ZhiHu
    twitter:         # Twitter
    x:               # X
    facebook:        # Facebook
    email:           # Email

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/scroll.html
# ---------------------------------------------------------------------------------------
scroll:
  # Show progress bar in top when page scroll
  progress_bar: false  # Option values: true | false

  # Show percent when page scroll
  percent: false       # Option values: true | false

  # Hide header in top when page scroll
  hide_header: true    # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/home.html
# ---------------------------------------------------------------------------------------
home:
  # Website announcement in home page
  announcement:

  # Show category in home page post block
  category: true           # Option values: true | false

  # Show tags in home page post block
  tag: true                # Option values: true | false

  # Set the datetime type of home page post block
  post_datetime: created    # Option values: updated | created

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/post.html
# ---------------------------------------------------------------------------------------
post:
  # Author badge in the post
  author_badge:
    enable: true         # Option values: true | false

    # If true, show Lv1, Lv2, Lv3 ...
    # If false, show custom badge
    level_badge: true    # Option values: true | false

    # Custom badge array, You can be fill one or more item
    custom_badge: ["One", "Two", "Three"]

  # Post word count
  # Depend on Hexo Plugin: hexo-wordcount (`npm install hexo-wordcount`)
  # See: https://github.com/willin/hexo-wordcount
  word_count:
    wordcount: false     # Word count, one post. Option values: true | false
    min2read: false      # Time to read, one post. Option values: true | false

  # Post datetime
  datetime_format: "YYYY-MM-DD HH:mm:ss"  # Datetime format. e.g. "YYYY-MM-DD HH:mm:ss"

  # Post copyright info
  copyright_info: false  # Option values: true | false

  # Post share
  share: false           # Option values: true | false

  # Reward author
  reward:
    enable: false        # Option values: true | false
    img_link:            # Image link for the payment QR code
    text:                # Custom reward text, Can be null
    icon:                # Custom reward icon, Can be null

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/code_block.html
# ---------------------------------------------------------------------------------------
code_block:
  # Toolbar include: "code copy", "code block collapse" and "code language"
  tools:
    enable: false            # Option values: true | false
    style: default           # Option values: default | mac
  highlight_theme: default   # Option values: default | obsidian

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/toc.html
# ---------------------------------------------------------------------------------------
toc:
  enable: false      # Option values: true | false

  # Automatically add list number to toc
  number: false      # Option values: true | false

  # If true, all level of TOC in a post will be displayed, rather than the activated part of it.
  expand_all: false  # Option values: true | false

  # If true, auto open TOC every time when you enter post page
  init_open: true    # Option values: true | false

  # TOC layout on post page
  layout: right      # Option values: left | right

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/website_count.html
# ---------------------------------------------------------------------------------------
website_count:
  # busuanzi
  # See: http://ibruce.info/2015/04/04/busuanzi/
  busuanzi_count:
    enable: false     # Option values: true | false
    site_uv: false    # Option values: true | false
    site_pv: false    # Option values: true | false
    page_pv: false    # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/local_search.html
# Depend on Hexo Plugin: hexo-generator-searchdb (`npm install hexo-generator-searchdb`)
# See: https://github.com/theme-next/hexo-generator-searchdb
# ---------------------------------------------------------------------------------------
local_search:
  enable: true   # Option values: true | false
  preload: false  # Preload the search data when the page loads. Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/comment.html
# ---------------------------------------------------------------------------------------
comment:
  enable: false   # Option values: true | false
  use: valine     # Option values: valine | gitalk | twikoo | waline | giscus | artalk | disqus

  # Valine
  # See: https://github.com/xCss/Valine
  #      https://valine.js.org
  valine:
    appid:           # Your leancloud application appid
    appkey:          # Your leancloud application appkey
    server_urls:     # Your Server URL
    placeholder:     # Input box placeholder

  # Gitalk
  # See: https://github.com/gitalk/gitalk
  #      https://gitalk.github.io
  gitalk:
    github_id:        # GitHub repo owner
    github_admins:    # GitHub Admins (in Array type), optional
    repository:       # Repository name to store issues
    client_id:        # GitHub Application Client ID
    client_secret:    # GitHub Application Client Secret
    proxy:            # GitHub oauth request reverse proxy for CORS

  # Twikoo
  # See: https://github.com/imaegoo/twikoo
  #      https://twikoo.js.org
  twikoo:
    env_id:          # Environment ID
    region:          # Environment region, Can be null
    version: 1.6.36  # Twikoo version, default use v1.6.36

  # Waline
  # See: https://github.com/walinejs/waline
  #      https://waline.js.org/guide/get-started.html
  waline:
    server_url:         # Server URL
    reaction: false     # Post reactions, option values: true | false
    version: 3.2.1      # Waline version, default use v3.2.1

  # Giscus
  # See: https://github.com/giscus/giscus
  #      https://giscus.app
  # Please generate your configuration items in https://giscus.app
  giscus:
    repo:
    repo_id:
    category: Announcements    # Recommend use Announcements
    category_id:
    reactions_enabled: false   # Option values: true | false

  # Artalk
  # See: https://github.com/ArtalkJS/Artalk
  #      https://artalk.js.org
  artalk:
    server:                    # Server URL

  # Disqus
  # See: https://disqus.com/
  disqus:
    shortname:                 # Disqus Shortname

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/rss.html
# Depend on Hexo Plugin: hexo-generator-feed (`npm install hexo-generator-feed`)
# See: https://github.com/hexojs/hexo-generator-feed
# ---------------------------------------------------------------------------------------
rss:
  enable: false  # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/lazyload.html
# ---------------------------------------------------------------------------------------
lazyload:
  enable: true  # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/cdn.html
# ---------------------------------------------------------------------------------------
cdn:
  enable: false       # Option values: true | false
  provider: cdnjs     # Option values: cdnjs | jsdelivr | unpkg

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/pjax.html
# ---------------------------------------------------------------------------------------
pjax:
  enable: false  # Option values: true | false

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/footer.html
# ---------------------------------------------------------------------------------------
footer:
  since: 2020            # The starting year of your website, Can be null
  word_count: false      # Option values: true | false

  site_deploy:
    enable: false        # Option values: true | false
    provider: github     # Option values: github | vercel | netlify | cloudflare | gitee | aliyun | tencent_cloud | upyun
    url:                 # Your deployment provider url, Can be null

  record:
    enable: false        # Option values: true | false
    list:
      - code:            # record code of your website
        link:            # record link of your website, Can be null
      # e.g.
      # - code: ICP 001
      # - link: https://beian.miit.gov.cn

# ---------------------------------------------------------------------------------------
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/inject.html
# ---------------------------------------------------------------------------------------
inject:
  enable: false  # Option values: true | false
  css:
    -
    # e.g.
    # - /css/custom-1.css
    # - /css/custom-2.css
    # - ...
  js:
    -
    # e.g.
    # - /js/custom-1.js
    # - /js/custom-2.js
    # - ...

Other Information | 其它信息

win10系统 chrome浏览器

XPoet commented 3 months ago

感谢反馈,该问题已修复,请使用 v4.2.2