广州活力数据恢复中心

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3242|回复: 8

[hexo] hexo相关信息

[复制链接]

92

主题

104

帖子

688

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
688
发表于 2020-8-19 20:27:35 | 显示全部楼层 |阅读模式
hexo相关信息
安装hexo
  1. npm install -g hexo-cli
复制代码
加上-g全局安装
如果报错:
  1. zsh: command not found: npm
复制代码
有可能是zsh配置问题或者没有安装node.假设是配置问题.
  1. source /Users/YOUUSERNAME/.bash_profile
复制代码
把上面这么代码添加到~/.zshrc这么修改还不行那很可能是没有安装node了
  1. ➜  ~ node -v               
  2. zsh: command not found: node
  3. ➜  ~ npm -v                 
  4. zsh: command not found: npm
复制代码
brew安装node
  1. brew install node
复制代码
测试
  1. ➜ ~  node -v               
  2. v15.6.0
  3. ➜ ~ -v
  4. 7.4.0
复制代码
安装hexo包
  1. npm install hexo
复制代码



hexo命令:
hexo g                #渲染

hexo clean          # 清除hexo内存

hexo s                # hexo启动,加上--debug可以debug hexo启动出错的原因

hexo server        #启动hexo服务,在本地浏览器预览效果.
hexo new a        #新建一个页面

hexo draft b       #新建草稿





hexo RSS
安装插件命令
  1. npm install hexo-generator-feed --save
复制代码




hexo tag

  1. title: 标签测试文章
  2. tags:
  3.   - Testing
  4.   - Another Tag
复制代码



本地预览网站效果
  1. hexo server
复制代码

部署到vps上
  1. hexo d -g
复制代码

清除已生成的静态文件
  1. hexo clean
复制代码


一体优盘数据恢复 www.rflashdata.com
硬盘ROM损坏焊爆丢失配ROM服务
buffalo 隨身碟數據救援 bitlocker WDV2 lacie EFS等加密硬盘数据恢复,指纹爱国者加密优盘数据恢复 +86 18620923827
回复

使用道具 举报

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2021-1-22 06:53:18 | 显示全部楼层
hexo read more 首页不生效解决方法

路径/themes/[主题名]/layout/_partial/article.ejs
原代码
  1. <div class="article-entry" itemprop="articleBody">
  2.       <% if (post.excerpt && index){ %>
  3.         <%- post.excerpt %>
  4.         <% if (theme.excerpt_link){ %>
  5.           <p class="article-more-link">
  6.             <a href="<%- url_for(post.path) %>#more"><%= theme.excerpt_link %></a>
  7.           </p>
  8.         <% } %>
  9.       <% } else { %>
  10.         <%- post.content %>
  11.       <% } %>
  12.     </div>
复制代码



改后
  1. <div class="article-entry" itemprop="articleBody">
  2.   <% if (post.excerpt && index) { %>
  3.     <%- post.excerpt %>
  4.     <% if (theme.excerpt_link) { %>
  5.       <p class="article-more-link">
  6.         <a href="<%- config.root %><%- post.path %>#more"><%= theme.excerpt_link %></a>
  7.       </p>
  8.     <% } %>
  9.   <% } else { %>
  10.     <% var br = post.content.indexOf('\n') %>
  11.     <% if(br < 0 || !index) { %>
  12.       <%- post.content %>
  13.     <% } else { %>
  14.       <%- post.content.substring(0, br) %>
  15.       <% if (theme.excerpt_link) { %>
  16.         <p class="article-more-link">
  17.           <a href="<%- config.root %><%- post.path %>#more"><%= theme.excerpt_link %></a>
  18.         </p>
  19.       <% } %>
  20.     <% } %>
  21.   <% } %>
  22. </div>
复制代码


硬盘数据恢复/优盘内存卡数据恢复/服务器数据恢复
data recovery service www.rflashdata.com 数据热线+86 18620923827(微信whatsapp)
回复 支持 反对

使用道具 举报

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2021-1-22 07:09:15 | 显示全部楼层
修改hexo模板





  1. ├── scaffolds
  2. │   ├── draft.md
  3. │   ├── page.md
  4. │   └── post.md
复制代码



修改hexo这个路径下对应的文件就可了.

硬盘数据恢复/优盘内存卡数据恢复/服务器数据恢复
data recovery service www.rflashdata.com 数据热线+86 18620923827(微信whatsapp)
回复 支持 反对

使用道具 举报

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2021-1-22 07:26:22 | 显示全部楼层
hexo plugins分享
hexo-list-related-posts
A hexo plugin that generates a list of links to related posts based on tags.
List is ordered by the number of matched tags.
Install
  1. $ npm install hexo-list-related-posts --save
复制代码

Usage
Add <%- list_related_posts([options]) %> in template file for article.
  1. ├── layout
  2. │   └── _partial
复制代码
下面的articel.ejs 插入代码在footer里面
  1. <footer class="article-footer">
  2. <a data-url="<%- post.permalink %>" data-id="<%= post._id %>" data-title="<%= post.title %>" class="article-share-link"><%= __('share') %></a>
  3. <% if (post.comments && config.disqus_shortname){ %>
  4. <a href="<%- post.permalink %>#disqus_thread" class="article-comment-link"><%= __('comment') %></a>
  5. <% } %>
  6. <% if (post.comments && theme.valine.enable && theme.valine.appId && theme.valine.appKey ){ %>
  7. <a href="<%- url_for(post.path) %>#comments" class="article-comment-link">
  8. <span class="post-comments-count valine-comment-count" data-xid="<%- url_for(post.path) %>" itemprop="commentCount"></span>
  9. <%= __('comment') %>
  10. </a>
  11. <% } %>
  12. <%- partial('post/tag') %>
  13. </footer>
复制代码
硬盘数据恢复/优盘内存卡数据恢复/服务器数据恢复
data recovery service www.rflashdata.com 数据热线+86 18620923827(微信whatsapp)
回复 支持 反对

使用道具 举报

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2021-1-22 09:35:48 来自手机 | 显示全部楼层
添加lazyload lazylod可以在用户不查看的时候,不加载相关部分,从而提升网站加载速度。 先是在next目录里clone仓库: git clone https://github.com/theme-next/theme-next-jquery-lazyload source/lib/jquery_lazyload 再把配置里的开关打开: lazyload: true
回复 支持 反对

使用道具 举报

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2021-1-22 09:39:27 来自手机 | 显示全部楼层
Next集成了站内搜索功能,可以先安装依赖 npm install hexo-generator-searchdb --save 然后设置主题配置文件: local_search:   enable: true   # If auto, trigger search by changing input.   # If manual, trigger search by pressing enter key or search button.   trigger: auto   # Show top n results per article, show all results by setting to -1   top_n_per_article: 3   # Unescape html strings to the readable one.   unescape: false   # Preload the search data when the page loads.   preload: false 复制代码以上就是全部优化
回复 支持 反对

使用道具 举报

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2021-1-28 11:16:49 | 显示全部楼层
hexo 命令



list post
  1. hexo list post
复制代码

hexo新文章
  1. hexo new post 'title'
复制代码




硬盘数据恢复/优盘内存卡数据恢复/服务器数据恢复
data recovery service www.rflashdata.com 数据热线+86 18620923827(微信whatsapp)
回复 支持 反对

使用道具 举报

59

主题

84

帖子

560

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
560
QQ
发表于 2021-7-26 15:48:36 | 显示全部楼层
  1. npm not found
复制代码

brew install node
回复 支持 反对

使用道具 举报

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2022-6-29 22:06:53 | 显示全部楼层
常见问题

hexo -s命令后本地服务没有起来. 报错如下


  1. INFO  Validating config
  2. Usage: hexo <command>

  3. Commands:
  4.   algolia   Index your content in Algolia Search API
  5.   clean     Remove generated files and cache.
  6.   config    Get or set configurations.
  7.   deploy    Deploy your website.
  8.   generate  Generate static files.
  9.   help      Get help on a command.
  10.   init      Create a new Hexo folder.
  11.   list      List the information of the site
  12.   migrate   Migrate your site from other system to Hexo.
  13.   new       Create a new post.
  14.   publish   Moves a draft post from _drafts to _posts folder.
  15.   render    Render files with renderer plugins.
  16.   server    Start the server.
  17.   version   Display version information.

  18. Global Options:
  19.   --config  Specify config file instead of using _config.yml
  20.   --cwd     Specify the CWD
  21.   --debug   Display all verbose messages in the terminal
  22.   --draft   Display draft posts
  23.   --safe    Disable all plugins and scripts
  24.   --silent  Hide output on console
复制代码
解决办法:
  1. hexo clean
复制代码
然后再hexo g
hexo s


如果hexo换电脑了怎样办? 有些人会用, 有些会用自己的同步方法,同步后发现hexo启动报错如下
  1. } Plugin load failed: %s hexo-renderer-stylus
  2. Usage: hexo <command>
复制代码
意思是本地没有这个插件需要重新安装,重装一下就可以, 当然你可能不止一个hexo的插件, 一个一个来
  1. npm install hexo-renderer-stylus --save
复制代码


硬盘数据恢复/优盘内存卡数据恢复/服务器数据恢复
data recovery service www.rflashdata.com 数据热线+86 18620923827(微信whatsapp)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|硬盘FLASH数据恢复论坛

GMT+8, 2024-5-14 05:12 , Processed in 0.037870 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表