feat(hexojs): Add generate alias and fix publish commands

- Add 'generate' as alias for 'build' command
- Rename cmd_publish for drafts to cmd_publish_draft
- Fix duplicate cmd_publish functions
- Add portal config section with /www/blog path
- publish draft <slug> for drafts, publish for portal
- Metabolizer integration now working

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-25 06:17:32 +01:00
parent 7a3b3eca23
commit 12cc8eae39
2 changed files with 25 additions and 17 deletions

View File

@ -38,3 +38,7 @@ config theme_config 'theme'
option accent_color '#f97316'
option logo_symbol '>'
option logo_text 'Blog_'
config portal 'portal'
option enabled '1'
option path '/www/blog'

View File

@ -93,16 +93,16 @@ Content Commands:
new post "Title" Create new blog post
new page "Title" Create new page
new draft "Title" Create new draft
publish <slug> Publish a draft
publish draft <slug> Publish a draft
list posts List all posts
list drafts List all drafts
Build Commands:
serve Start preview server (port $http_port)
build Generate static files
build (generate) Generate static files
clean Clean generated files
deploy Deploy to configured git target
publish Copy static files to /www/
publish Copy static files to /www/blog/
Service Commands:
service-run Run in foreground (for init)
@ -668,14 +668,14 @@ cmd_new_draft() {
lxc_exec sh -c "cd /opt/hexojs/site && hexo new draft \"$title\""
}
cmd_publish() {
cmd_publish_draft() {
require_root
load_config
local slug="$1"
if [ -z "$slug" ]; then
log_error "Slug required"
echo "Usage: hexoctl publish <slug>"
echo "Usage: hexoctl publish draft <slug>"
return 1
fi
@ -1132,8 +1132,6 @@ case "${1:-}" in
esac
;;
publish) shift; cmd_publish "$@" ;;
list)
shift
case "${1:-}" in
@ -1144,10 +1142,16 @@ case "${1:-}" in
;;
serve) shift; cmd_serve "$@" ;;
build) shift; cmd_build "$@" ;;
build|generate) shift; cmd_build "$@" ;;
clean) shift; cmd_clean "$@" ;;
deploy) shift; cmd_deploy "$@" ;;
publish) shift; cmd_publish "$@" ;;
publish)
shift
case "${1:-}" in
draft) shift; cmd_publish_draft "$@" ;;
*) cmd_publish "$@" ;;
esac
;;
logs) shift; cmd_logs "$@" ;;
shell) shift; cmd_shell "$@" ;;