当前位置: 首页 > 工具软件 > jf-admin > 使用案例 >

hexo-admin快速发布博客

张炳
2023-12-01

hexo-admin插件可为hexo提供可视化界面,用来管理博客文章,发布博客。

安装

博客根目录打开git bash

npm install --save hexo-admin

启动hexo服务

hexo s

配置

此时应能打开 http://localhost:4000/admin

  • 点击settings,
  • 在seetings下,点击 “setup authentification here” 链接
  • 输入自定义 username、password 和 Secret
  • copy生成的“admin config section” 文本,放到博客根目录 _config.yml 配置文件中。内容示例如下
# hexo-admin authentification
admin:
  username: username
  password_hash: $2a$10$L.XAIqIWgTc5S1zpvV3MEu7/rH34p4Is/nq824smv8EZ3lIPCp1su
  secret: my super secret phrase

设置Deploy

windows系统下按如下设置

  • 博客根目录建立批处理文件hexo-publish.bat,内容如下:
@echo off
call hexo g && hexo d
  • 在上述_config.yml中 admin部分修改如下:
# hexo-admin authentification
admin:
  username: username
  password_hash: $2a$10$L.XAIqIWgTc5S1zpvV3MEu7/rH34p4Is/nq824smv8EZ3lIPCp1su
  secret: my super secret phrase
  deployCommand: ‘hexo-publish.bat'
  • 重启hexo 服务

使用

  • 启动hexo服务
  • 访问http://localhost:4000/admin
  • post页面发布博客,发完本地即可访问
  • deploy页面同步到远程服务器。
    注意,deploy已在配置文件中做了设置,此处文本框无须再填任何东西,直接点deploy即可。
 类似资料: