| name | Hugo Preview |
| description | This skill should be used when the user asks to "preview blog", "start hugo server", "preview post", "see blog locally", "blog preview", "hugo preview", "run dev server", or wants to preview the blog locally with Hugo. |
| argument-hint | [post-slug] |
| allowed-tools | ["Bash","Read"] |
Hugo Preview
Start the Hugo development server for local preview of the blog, including draft posts.
Workflow
1. Check Prerequisites
Verify Hugo is installed: hugo version
2. Check for Existing Server
Before starting, check if Hugo is already running:
pgrep -f "hugo server" && echo "Hugo already running" || echo "No Hugo server found"
If already running, skip to step 4 and report the URL.
3. Start Dev Server
Use the Bash tool with run_in_background: true to start Hugo:
hugo server -D --navigateToChanged
IMPORTANT: Do NOT pipe the output through head, tail, or any other command. Piping causes Hugo to receive SIGPIPE and terminate after a few seconds. Always run the command directly with run_in_background: true.
Flags:
-D: Include draft posts (essential for previewing work-in-progress)
--navigateToChanged: Auto-navigate browser to changed content
4. Report URL
Wait a couple of seconds, then verify the server is responding:
sleep 2 && curl -s -o /dev/null -w "%{http_code}" http://localhost:1313/
The server typically starts at http://localhost:1313/. Report the URL.
If a specific post slug was provided as argument, determine the correct direct URL by checking the Hugo permalink configuration in config/_default/hugo.yaml (look for the permalinks section). For example:
permalinks: posts: /:slug/ means the URL is http://localhost:1313/<slug>/
permalinks: posts: /posts/:slug/ means the URL is http://localhost:1313/posts/<slug>/
If no permalink config is found, fall back to http://localhost:1313/<slug>/.
5. Background Operation
The server runs in the background, watches for file changes, and auto-reloads.
To stop: kill the Hugo process with pkill -f "hugo server".