使用Hexo theme nexT并加入utterances comment

2019年8月1日更新的NexT 7.3.0 版本集成了utterances评论

  1. 工作目录安装NexT: hexo 5 支持用npm安装主题了
    npm install hexo-theme-next
    会安装到\node_modules\hexo-theme-next中

  2. github上安装Utterances:用readme指导更新:
    一定要先在github先建立一个新的public repo:
    repository: your_github_name/new_comment_repo_name

然后在github的setting中安装配置application: utterances 并指定使用上面的新repo。
https://github.com/apps/utterances

然后在本地目录安装
>npm install theme-next/hexo-next-utteranc

先使用next theme,靠改工作目录的_config.yml :
>theme: 从缺省的landscape改为next
同时为了utterances正确验证,需要更新的_config.yml配置文件的url项。 把它改为博客域名。

最后激活评论,在另一个文件\node_modules\hexo-theme-next_config.yml文件的utterances部分,只需要改两行:
>enable: true
>repo: your_github_name/new_comment_repo_name #Warehouse name, format: your-user-ID/warehouse-name
nexT会自动在页面尾部位置加入comment部分.
完毕。下面是一些零散信息。

配置nexT的scheme: 修改\node_modules\hexo-theme-next_config.yml
换theme后,最好hexo clean 清理cache first.

  1. 更新模块Install the latest version throuth npm:

    cd hexo-site
    npm install hexo-theme-next@latest

有关地址:
https://github.com/next-theme/hexo-theme-next

https://github.com/utterance/utterances

  1. 各种hexo有关事项
    Hexo With NexT on Github Page
    https://mxdzs0612.github.io/%E5%85%B6%E5%AE%83%E6%8A%80%E6%9C%AF/2019-07-29-HexoBlog2.html
    https://uu3.gitlab.io/2020/12/03/series001/AN004-Configure-hexo-theme-next%20/
    https://zhangjk98.xyz/bd8f/
    https://segmentfault.com/a/1190000021486019
    https://zhangzw.com/posts/20190720.html
    https://nekodaemon.com/2020/05/20/Hexo-Next%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0Utterances%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/

以调试方式运行。Hexo local server with debug parameter (by adding –debug):
hexo s –debug

  1. 信息
    https://github.com/apps/utterances
    目前issue的名称似乎只支持pathname,当路径为中文时,此种方式可能会产生乱码。

Plugins extend and expand the functionality of NexT. There are two types of plugins: core plugins and third-party plugins. The core plugins are required by the basic functions of NexT. Third-party plugins provide a large number of optional features.

Configuring these plugins is very easy. For example, if you want to enable pjax on your site, just set pjax to true in NexT config file:

如果comment不出现,这是hexo与第三方plugin互动的问题。加上github的app,比较复杂。
_config.yml: or in \node_modules\hexo-theme-next

  1. custom域名:
    1域名服务器:其中CNAME的host设为www,value就填写你的github page的值(xxx.github.io),
    A的host设为@, value可以通过ping xxx.github.io得到。
    2接下来,去到你的github page repo的settings界面(不是account 的setting),在Github pages小节的custom domain添加你的域名:
    3最后一步,在你本地 /source 文件夹下添加一个名为CNAME的文件(注意,此文件没有后缀),里面添加你的域名即可。

———2————–

  1. 版本信息

    Documentation: https://theme-next.js.org

    hexo -version 结果
    NexT version 8.2.1
    hexo: 5.3.0
    hexo-cli: 4.2.0
    node: 14.15.4