Coder Social home page Coder Social logo

Comments (23)

welcome avatar welcome commented on July 20, 2024

Thanks for opening this issue, maintainers will get back to you as soon as possible!

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

这个改为默认不太好吧,更新日期大多数人习惯,且 hexo _config设置文件里有设置更新日期的选项,不建议直接更新在主题里。

或是:
next _config.yml

# Post meta display settings 
post_meta:
  item_text: true
  created_at: true
  updated_at:
    enable: false
    another_day: true
  categories: true

updated_at: enable: true

或是:

hexo _config.yml

index_generator:
  path: ''
  per_page: 5  
  order_by: -date   #可选 -updated 更新日期排列

可以解决你所需问题。

from hexo-theme-next.

stevenjoezhang avatar stevenjoezhang commented on July 20, 2024

Docs here: http://theme-next.js.org/docs/theme-settings/posts.html#Post-Meta-Display

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024
# Post meta display settings
post_meta:
  item_text: true
  created_at: true
  updated_at:
    enable: true
    another_day: true
  categories: true

I had set these config, but it didn't work. Does any other plugin need to be installed?

I mean my blog article doesn't have update time info. https://blog.caoyu.info/

  • If the theme support this feature, how to configure it?
  • If not support, can we integrate it as default feature?

from hexo-theme-next.

stevenjoezhang avatar stevenjoezhang commented on July 20, 2024

Nope, no other plugins required. Try

another_day: false

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

It not work

from hexo-theme-next.

stevenjoezhang avatar stevenjoezhang commented on July 20, 2024

This means that Hexo cannot read the updated time of the article correctly. If you want to get help from others, please provide your environment information, such as operating system, Node.js version, Hexo version, etc.

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

FYI.

λ npx hexo -v
hexo: 4.2.1
hexo-cli: 3.1.0
os: Windows_NT 10.0.17763 win32 x64
node: 13.5.0
v8: 7.9.317.25-node.23
uv: 1.34.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 79
nghttp2: 1.40.0
napi: 5
llhttp: 2.0.1
openssl: 1.1.1d
cldr: 36.0
icu: 65.1
tz: 2019c
unicode: 12.1


λ cat package.json
{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "4.2.1"
  },
  "dependencies": {
    "hexo": "4.2.1",
    "hexo-baidu-url-submit": "0.0.6",
    "hexo-deployer-git": "^2.1.0",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-baidu-sitemap": "^0.1.6",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-feed": "^2.2.0",
    "hexo-generator-index": "^1.0.0",
    "hexo-generator-searchdb": "^1.3.0",
    "hexo-generator-sitemap": "^2.0.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-helper-live2d": "^3.1.1",
    "hexo-pwa": "git+https://github.com/mystic-cg/hexo-pwa.git",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-marked": "^2.0.0",
    "hexo-renderer-stylus": "^1.1.0",
    "hexo-server": "^1.0.0",
    "hexo-symbols-count-time": "^0.7.1",
    "live2d-widget-model-koharu": "^1.0.5",
    "live2d-widget-model-z16": "^1.0.5",
    "npm-check-updates": "^6.0.1"
  }
}

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

试试:
hexo _config.yml

index_generator:
  path: ''
  per_page: 5  
  order_by:  -updated

重新hexo clean hexo g hexo s
这个是可以实现的。

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

@aixiu
即使更改了order_by: -updated,依然是一样的

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

@mysit-cg 我是经过测试了,改为order_by: -updated,并依次更新了本地测试正常。

 hexo -v && node -v
hexo: 4.2.0
hexo-cli: 3.1.0
os: Windows_NT 6.1.7601 win32 x64
node: 12.16.1
v8: 7.8.279.23-node.31
uv: 1.34.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 72
nghttp2: 1.40.0
napi: 5
llhttp: 2.0.4
http_parser: 2.9.3
openssl: 1.1.1d
cldr: 35.1
icu: 64.2
tz: 2019c
unicode: 12.1
v12.16.1

并且,

$ npm ls --depth 0
[email protected] E:\My_blog
+-- [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] (github:theme-next/hexo-next-tag#095ca82d63db8e6e5231fa9a811d3d68f3d8cc88)
+-- [email protected] (github:theme-next/hexo-next-title#34aff1125fe990f87cb80e148f2c9dfa43f3eb84)
+-- [email protected] (github:theme-next/hexo-next-utteranc#f592272a73cb47923f25443709786942f0398a69)
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- UNMET PEER DEPENDENCY react@^16.8.0
+-- UNMET PEER DEPENDENCY react-dom@^16.8.0
`-- [email protected]

没有安装任何影响排序的插件,或是更改过这类机制的模板,比如:置顶文章。

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

@aixiu 可以发一下你的截图么,Thanks♪(・ω・)ノ

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

@mystic-cg 配置上边已经有了,就发两张实际效果。
image 相关配置
image 实际效果,看看文章发表时间排序。
image
这是md文档修改时间

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

@aixiu
你理解错我的意思了, 我想要的是有更新日期, 而不是以更新日期排序显示.
因为可以通过自己添加代码,实现"发表于" 和 "更新于"这种功能
所以, 我想主题是否应该直接集成这个功能呢

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

@mystic-cg
image
效果:如果有更新则显示更新时间,没有则不显示,配置文件见主题config.yml
主题已经自带了。。
next _config.yml

# Post meta display settings 
post_meta:
  item_text: true
  created_at: true
  updated_at:
    enable: true
    another_day: true
  categories: true

主要是 updated_at: 启用 enable: true。另:如果 another_day: flase 则没更新,也显示更新日期和发表日期为同一天。默认是开启的,没更新则不显示。

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

@aixiu 我的一直没生效

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

@mystic-cg https://theme-next.js.org/docs/theme-settings/posts 这里的文档也有 Post Meta Display
image

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

我这些都做过,但是一直没生效
我的这个地址,我最近肯定有更新的,但是就是没显示
https://blog.caoyu.info/design-pattern.html

不确定是否因为,我将主题选择为英文模式有关?

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

还不能确定,我所使用的插件,上边已经发了,还有主题使用也是和你一个版本,你本地测试中文模式试试。我很确定主题已经自带了你需要的功能。我没试过英文模式,所以不敢确定是不是BUG

from hexo-theme-next.

pplmx avatar pplmx commented on July 20, 2024

@aixiu
image
可以工作

theme和hexo之间的配置应该有冲突了 @stevenjoezhang
image
将这个设置为false, 就可以了

from hexo-theme-next.

aixiu avatar aixiu commented on July 20, 2024

@mystic-cg 可能,我这个默认是未开启的。。恭喜你,解决问题。

from hexo-theme-next.

stevenjoezhang avatar stevenjoezhang commented on July 20, 2024

问题解决了就好。use_date_for_updated 的默认值就是 false。设置为 true 时会导致更新日期不显示。
这个选项可能会在 Hexo 5 中被修改, 请注意有关动态: hexojs/hexo#4278
updated_option 特性目前不可用,将会在未来被 Hexo 支持。

如果更新到 Hexo 5,需要注意在 Hexo _config.yml 中使用

updated_option: 'mtime'

代替

use_date_for_updated: false

from hexo-theme-next.

github-actions avatar github-actions commented on July 20, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.

from hexo-theme-next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.