跳转到内容

move - 移动文章到新位置

move 命令将文章和其关联的资源移动到新的位置,自动处理路径更新,确保资源引用保持一致。

Terminal window
hyc move <search> <target>
参数说明必需
<search>查询关键词(标题、slug 或路径)
<target>目标位置(支持相对路径、绝对路径或 @/ 开头的项目相对路径)
Terminal window
# 相对于内容目录(content/posts/)
hyc move "article" "./tech"
hyc move "article" "tech"
Terminal window
# 完整的绝对路径
hyc move "article" "E:\myproject\content\posts\tech"
Terminal window
# 使用 @/ 前缀表示项目根目录
hyc move "article" "@/content/posts/tech"
Terminal window
# 将文章移动到 tech 分类目录
hyc move "my-article" "@/content/posts/tech"
# 结果:
# 原路径: @/content/posts/my-article.md
# 新路径: @/content/posts/tech/my-article.md
Terminal window
# 目标目录无需事先存在
hyc move "old-article" "@/content/posts/javascript"
# 系统会自动创建 javascript 目录
Terminal window
# 将文章从分类目录移出
hyc move "nested-article" "@/content/posts"
Terminal window
# 支持多层目录路径
hyc move "article" "@/content/posts/technology/web/frontend"

move 命令会自动处理文章中的资源路径更新:

# 移动前 (在 @/content/posts/)
![image](./assets/image.jpg)
![cover](./hero.png)
# 移动后 (在 @/content/posts/tech/)
![image](../assets/image.jpg)
![cover](../hero.png)

如果启用了 .hexo-assetdir 模式,资源文件夹也会跟随移动:

移动前:
content/posts/
├── article.md
└── article/
└── images/
移动后:
content/posts/tech/
├── article.md
└── article/
└── images/
命令功能用途
move移动到特定目录手动调整单个文章位置
sort按规则重组全部批量重新组织项目结构
rename修改文件名改变文件名而保持目录
  • 使用 category 设置文章分类(推荐与 move 结合)
  • 使用 sort 批量重组项目结构
  • 使用 list 验证移动结果
津 ICP 备2022001375 号
津公网安备 12011402001353 号