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 accent_color '#f97316'
option logo_symbol '>' option logo_symbol '>'
option logo_text 'Blog_' option logo_text 'Blog_'
config portal 'portal'
option enabled '1'
option path '/www/blog'

View File

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