字数统计问题❓ #4337
Unanswered
KIRINICE001
asked this question in
Q&A
字数统计问题❓
#4337
Replies: 1 comment
问题原因你现在修改的 const { postCount, wordCount } = props但项目并没有向统计卡片传入顶层的 <div>{wordCount}</div>最终得到的是 props.post.wordCount
props.post.readTime也就是说,现有数据结构是“当前文章字数”,不是“全站总字数”。(raw.githubusercontent.com) 推荐实现方式在服务端构建全站数据时:
这样可以同时实现:
项目已经有字数计算函数,而且文章摘要清理逻辑本身就保留了 需要注意的性能问题这种方式需要在全站数据重新生成时读取每篇文章的正文。文章数量越多,首次 Vercel 构建耗时越长。代码中使用了并发数 最关键的一点是:只修改 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
问题描述
老师我还有一个问题,请问一下notionnext如何做到每篇文章的字数都能够自动统计,并且能够自动统计总字数展示在统计卡片上呢?
环境信息
NotionNext 4.10.8 hexo主题
vercel部署
已尝试的步骤
询问了ChatGPT,对「themes/hexo/components/AnalyticsCard.js」的代码做了修改

但我只是按照AI提供的代码结合原有的代码做了调整,结果发现总字数这一部分没有显示内容:
目前没有尝试让每篇文章的字数显示出来。
All reactions