hexo-related-popular-posts icon indicating copy to clipboard operation
hexo-related-popular-posts copied to clipboard

Multiple posts could not contain a same tag (TypeError: this.localeData(...).postformat is not a function)

Open yihuajack opened this issue 3 years ago • 1 comments

For BUG

  • BUG description For example, if I added tag "WSL" to post "CSDN-4" and "CSDN-3" at the same time, the command hexo g would fail. However, if I deleted any of them, the problem disappeared. Besides, if I set
related_posts:
  enable: false

then the problem also disappeared, so I could make sure that it is somehow related to this plugin.

  • the way to reproduce Keep related_posts enabled. Add a tag to both two posts. Execute hexo clean and hexo g.
  • log with hexo The output of hexo g:
INFO  Validating config
INFO  Start processing
INFO  Files loaded in 1.63 s
ERROR Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 19, Column 14]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\head\head-unique.swig) [Line 10, Column 23]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 3, Column 3]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\index.swig) [Line 6, Column 15]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\sub-menu.swig) [Line 2, Column 29]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\sub-menu.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 5, Column 3]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 9, Column 12]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_macro\post.swig) [Line 214, Column 16]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\post\post-related.swig)
  TypeError: this.localeData(...).postformat is not a function
    at Object._prettifyError (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\lib.js:36:11)
    at D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:561:19
    at Template.root [as rootRenderFunc] (eval at _compile (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:631:18), <anonymous>:43:3)
    at Template.render (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:550:10)
    at D:\Documents\Programming\HexoBlog\themes\next\scripts\renderer.js:32:29
    at _View._compiled (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\theme\view.js:136:50)
    at _View.render (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\theme\view.js:39:17)
    at D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\hexo\index.js:64:21
    at tryCatcher (D:\Documents\Programming\HexoBlog\node_modules\bluebird\js\release\util.js:16:23)
    at D:\Documents\Programming\HexoBlog\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\hexo\router.js:47:5)
    at RouteStream.Readable.read (_stream_readable.js:467:10)
    at resume_ (_stream_readable.js:981:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
ERROR Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 19, Column 14]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\head\head-unique.swig) [Line 10, Column 23]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 3, Column 3]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\index.swig) [Line 6, Column 15]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\sub-menu.swig) [Line 2, Column 29]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\header\sub-menu.swig)
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 5, Column 3]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\post.swig) [Line 9, Column 12]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_macro\post.swig) [Line 214, Column 16]
  Template render error: (D:\Documents\Programming\HexoBlog\themes\next\layout\_partials\post\post-related.swig)
  TypeError: this.localeData(...).postformat is not a function
    at Object._prettifyError (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\lib.js:36:11)
    at D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:561:19
    at Template.root [as rootRenderFunc] (eval at _compile (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:631:18), <anonymous>:43:3)
    at Template.render (D:\Documents\Programming\HexoBlog\node_modules\nunjucks\src\environment.js:550:10)
    at D:\Documents\Programming\HexoBlog\themes\next\scripts\renderer.js:32:29
    at _View._compiled (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\theme\view.js:136:50)
    at _View.render (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\theme\view.js:39:17)
    at D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\hexo\index.js:64:21
    at tryCatcher (D:\Documents\Programming\HexoBlog\node_modules\bluebird\js\release\util.js:16:23)
    at D:\Documents\Programming\HexoBlog\node_modules\bluebird\js\release\method.js:15:34
    at RouteStream._read (D:\Documents\Programming\HexoBlog\node_modules\hexo\lib\hexo\router.js:47:5)
    at RouteStream.Readable.read (_stream_readable.js:467:10)
    at resume_ (_stream_readable.js:981:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
INFO  Generated: posts/1944.html
INFO  Generated: posts/54448.html
INFO  Generated: atom.xml
INFO  Generated: images/algolia_logo.svg
INFO  Generated: board/index.html
INFO  Generated: search.xml
INFO  Generated: about/index.html
INFO  Generated: links/index.html
INFO  Generated: categories/CSDN/index.html
INFO  Generated: categories/index.html
INFO  Generated: tags/index.html
INFO  Generated: archives/index.html
INFO  Generated: archives/2020/index.html
INFO  Generated: tags/Adobe/index.html
INFO  Generated: tags/Adobe安装错误/index.html
INFO  Generated: tags/Visual-Studio-Installer-Error/index.html
INFO  Generated: tags/用户文件夹/index.html
INFO  Generated: tags/CLion/index.html
INFO  Generated: tags/git-clone/index.html
INFO  Generated: tags/WSL2/index.html
INFO  Generated: tags/WSL/index.html
INFO  Generated: tags/github/index.html
INFO  Generated: tags/matlab/index.html
INFO  Generated: tags/rpc-failed/index.html
INFO  Generated: tags/opentype/index.html
INFO  Generated: tags/tutorial/index.html
INFO  Generated: tags/ttf/index.html
INFO  Generated: posts/9336.html
INFO  Generated: 1f4e7.png
INFO  Generated: images/apple-touch-icon-next.png
INFO  Generated: images/cc-by-nc-nd.svg
INFO  Generated: images/cc-by-nd.svg
INFO  Generated: images/avatar.gif
INFO  Generated: images/cc-by-nc-sa.svg
INFO  Generated: images/cc-by-sa.svg
INFO  Generated: images/cc-by-nc.svg
INFO  Generated: images/favicon-16x16-next.png
INFO  Generated: images/cc-by.svg
INFO  Generated: images/cc-zero.svg
INFO  Generated: images/logo.svg
INFO  Generated: images/favicon-32x32-next.png
INFO  Generated: posts/16107.html
INFO  Generated: posts/57547.html
INFO  Generated: posts/24163.html
INFO  Generated: posts/18163.html
INFO  Generated: posts/61472.html
INFO  Generated: posts/23359.html
INFO  Generated: lib/font-awesome/webfonts/fa-regular-400.woff2
INFO  Generated: js/algolia-search.js
INFO  Generated: lib/canvas-nest/LICENSE
INFO  Generated: lib/fancybox/source/jquery.fancybox.min.css
INFO  Generated: js/schemes/muse.js
INFO  Generated: lib/fancybox/README.html
INFO  Generated: lib/velocity/velocity.ui.min.js
INFO  Generated: archives/2019/07/index.html
INFO  Generated: images/avatar.jpg
INFO  Generated: js/bookmark.js
INFO  Generated: js/motion.js
INFO  Generated: js/local-search.js
INFO  Generated: js/next-boot.js
INFO  Generated: js/schemes/pisces.js
INFO  Generated: lib/canvas-nest/README.html
INFO  Generated: lib/canvas-nest/canvas-nest-nomobile.min.js
INFO  Generated: lib/canvas-nest/canvas-nest.min.js
INFO  Generated: archives/2019/12/index.html
INFO  Generated: archives/2020/02/index.html
INFO  Generated: archives/2020/03/index.html
INFO  Generated: archives/2019/10/index.html
INFO  Generated: archives/2020/09/index.html
INFO  Generated: js/utils.js
INFO  Generated: index.html
INFO  Generated: archives/2019/index.html
INFO  Generated: lib/anime.min.js
INFO  Generated: lib/fancybox/source/jquery.fancybox.css
INFO  Generated: css/main.css
INFO  Generated: lib/fancybox/LICENSE
INFO  Generated: assets/algolia/algoliasearchLite.min.js
INFO  Generated: lib/velocity/velocity.min.js
INFO  Generated: lib/font-awesome/css/all.min.css
INFO  Generated: assets/algolia/algoliasearch.min.js
INFO  Generated: lib/font-awesome/webfonts/fa-brands-400.woff2
INFO  Generated: lib/font-awesome/webfonts/fa-solid-900.woff2
INFO  Generated: assets/algolia/algoliasearchLite.js
INFO  Generated: lib/fancybox/source/jquery.fancybox.min.js
INFO  Generated: assets/algolia/algoliasearch.js
INFO  Generated: lib/fancybox/source/jquery.fancybox.pack.js
INFO  86 files generated in 1.26 s

OS version

  • Windows (Windows 10 version 2004 Build 19041.508)

Node version(node -v)

v12.18.4

Your site _config.yml

url: https://yihuajack.github.io
root: /
permalink: posts/:abbrlink.html
abbrlink:
    alg: crc16   #算法: crc16(default) and crc32
    rep: dec     #进制: dec(default) and hex
permalink_defaults:
pretty_urls:
  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: true
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true # Open external links in new tab
  field: site # Apply to the whole site
  exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: true
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  enable: false
  preprocess: true
  line_number: true
  tab_replace: ''
index_generator:
  path: ''
  per_page: 10
  order_by: -date
default_category: uncategorized
category_map:
tag_map:
meta_generator: true
date_format: YYYY-MM-DD
time_format: HH:mm:ss
updated_option: 'mtime'
per_page: 10
pagination_dir: page
include:
exclude:
ignore:
plugin:
- hexo-generator-feed
feed:
  type: atom
  path: atom.xml
  limit: 20
  hub:
  content:
  content_limit: 140
  content_limit_delim: ' '
  order_by: -date
  autodiscovery: true
  template:
theme: next
deploy:
  type: git
  repo:
    github: xxx
    coding: xxx
githubEmojis:
  enable: true
  className: github-emoji
  inject: true
  styles:
  customEmojis:
    e-mail: https://twemoji.maxcdn.com/v/13.0.1/72x72/1f4e7.png
algolia:
  applicationID: xxx
  apiKey: xxx
  adminApiKey: xxx
  indexName: Ayka's Blog
  chunkSize: 5000

Your theme _config.yml

scheme: Pisces
darkmode: true
menu:
  home: / || fa fa-home
  about: /about/ || fa fa-user
  tags: /tags/ || fa fa-tags
  categories: /categories/ || fa fa-th
  archives: /archives/ || fa fa-archive
  #schedule: /schedule/ || fa fa-calendar
  #sitemap: /sitemap.xml || fa fa-sitemap
  commonweal: /404/ || fa fa-heartbeat
  links: /links/ || fa fa-link
avatar:
  url: /images/avatar.jpg
  rounded: true
  rotated: true
links:
  CSDN: https://blog.csdn.net/yihuajack
related_posts:
  enable: true
  title: 相关文章 # Custom header, leave empty to use the default one
  display_in_home: false
  params:
    maxCount: 5
    #PPMixingRate: 0.0
    isDate: true
calendar:
  calendar_id: [email protected] # Your Google account E-Mail
  api_key: xxx
  orderBy: startTime
  offsetMax: 24 # Time Range
  offsetMin: 4 # Time Range
  showDeleted: false
  singleEvents: true
  maxResults: 250
github_banner:
  enable: true
  permalink: https://github.com/yihuajack
  title: Follow me on GitHub
font:
  enable: true
  global:
    external: true
    family: Lato
    size:
  title:
    external: true
    family:
    size:
  headings:
    external: true
    family:
    size:
  posts:
    external: true
    family:
  codes:
    external: true
    family: JetBrains Mono
pjax: true
fancybox: true
valine:
  enable: true
  appid: xxx
  appkey: xxx
  notify: false # Mail notifier
  verify: false # Verification code
  placeholder: Just go go # Comment box placeholder
  avatar: mm # Gravatar style
  guest_info: nick,mail,link # Custom comment header
  pageSize: 10 # Pagination size
  language: en, zh-cn # Language, available values: en, zh-cn
  visitor: true # Article reading statistic
  comment_count: true # If false, comment count will only be displayed in post page, not in home page
  recordIP: false # Whether to record the commenter IP
  serverURLs: 
rating:
  enable: true
  id: 27455    # <app_id>
  color:  fc6423
algolia_search:
  enable: true
  hits:
    per_page: 10
  labels:
    input_placeholder: Search for Posts
    hits_empty: "We didn't find any results for the search: ${query}"
    hits_stats: "${hits} results found in ${time} ms"
defaultlinks:
  - nickname: Heson     # 昵称
    avatar: https://cdn.jsdelivr.net/gh/heson525/pic@master/pic/avatar03.png    # 头像地址
    site: https://www.heson10.com #友链地址
    info: 人生在勤,不索何获
friendslinks:

Plugin version(npm ls --depth 0)

[email protected] D:\Documents\Programming\HexoBlog
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

yihuajack avatar Oct 02 '20 00:10 yihuajack

是的,我也遇到了,后面怎么解决的

hushanjushi avatar Jan 23 '22 10:01 hushanjushi