refactor: Rename docusaurus command to docs
- Change command name from 'docusaurus' to 'docs' - Update path handling for empty Docusaurus paths - Adjust example usage in documentation
This commit is contained in:
@@ -9,7 +9,7 @@ import cli { Command, Flag }
|
|||||||
|
|
||||||
pub fn cmd_docusaurus(mut cmdroot Command) Command {
|
pub fn cmd_docusaurus(mut cmdroot Command) Command {
|
||||||
mut cmd_run := Command{
|
mut cmd_run := Command{
|
||||||
name: 'docusaurus'
|
name: 'docs'
|
||||||
description: 'Generate, build, run docusaurus sites.'
|
description: 'Generate, build, run docusaurus sites.'
|
||||||
required_args: 0
|
required_args: 0
|
||||||
execute: cmd_docusaurus_execute
|
execute: cmd_docusaurus_execute
|
||||||
|
|||||||
@@ -39,12 +39,24 @@ pub fn (page Page) process_links(paths map[string]string) ![]string {
|
|||||||
|
|
||||||
// Try to get Docusaurus-specific path from Redis
|
// Try to get Docusaurus-specific path from Redis
|
||||||
if docusaurus_path := redis.hget('doctree_docusaurus_paths', ptr.str()) {
|
if docusaurus_path := redis.hget('doctree_docusaurus_paths', ptr.str()) {
|
||||||
// Use Docusaurus path (already without .md extension)
|
// Only use the Docusaurus path if it's not empty
|
||||||
// Ensure it starts with / for absolute path
|
if docusaurus_path.trim_space() != '' {
|
||||||
if docusaurus_path.starts_with('/') {
|
// Use Docusaurus path (already without .md extension)
|
||||||
path = docusaurus_path
|
// Ensure it starts with / for absolute path
|
||||||
|
if docusaurus_path.starts_with('/') {
|
||||||
|
path = docusaurus_path
|
||||||
|
} else {
|
||||||
|
path = '/' + docusaurus_path
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
path = '/' + docusaurus_path
|
// Empty Docusaurus path, fall back to default behavior
|
||||||
|
// Fall back to default behavior: relative paths with .md
|
||||||
|
if ptr.collection == page.collection_name {
|
||||||
|
// same directory
|
||||||
|
path = './' + path.all_after_first('/')
|
||||||
|
} else {
|
||||||
|
path = '../${path}'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fall back to default behavior: relative paths with .md
|
// Fall back to default behavior: relative paths with .md
|
||||||
|
|||||||
@@ -15,16 +15,15 @@ For quick setup and development, use the hero command:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Start development server
|
# Start development server
|
||||||
hero docusaurus -d -path /path/to/your/site
|
hero docs -d -path /path/to/your/site
|
||||||
|
|
||||||
# Build for production
|
# Build for production
|
||||||
hero docusaurus -b -path /path/to/your/site
|
hero docs -b -path /path/to/your/site
|
||||||
|
|
||||||
# Build and publish
|
# Build and publish
|
||||||
hero docusaurus -bp -path /path/to/your/site
|
hero docs -bp -path /path/to/your/site
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Example HeroScript
|
### Example HeroScript
|
||||||
|
|
||||||
```heroscript
|
```heroscript
|
||||||
|
|||||||
Reference in New Issue
Block a user