Hawk.js CLI Documentation
Hawk.js provides a powerful CLI tool to automate sitemap generation and submission to search engines using various supported strategies. This guide will walk you through the commands, options, and best practices for using the Hawk.js CLI.
Getting Started
The CLI can be invoked using the hawk
command once Hawk.js is installed globally or locally in your project.
hawk [options] [command]
Global Options
The following global options apply to all commands in the CLI:
Option | Alias | Default | Description |
---|---|---|---|
--strategy | -s | (Required) | The indexing strategy to use (see strategies below). |
--include | -i | Configured lookup patterns | Specify file patterns to include in sitemap generation. |
--exclude | -e | Configured ignore patterns | Specify file patterns to exclude from sitemap generation. |
--prettify | -p | false | Prettify the output of the generated sitemap.xml file for better readability. |
Supported Strategies
Choose one of the following strategies by providing the corresponding number with the --strategy
option:
Strategy Number | Strategy Name | Description |
---|---|---|
1 | IndexNow | Notify search engines like Bing and Yandex about content changes. |
2 | GWebMaster | Generate and submit sitemaps to Google Search Console. |
3 | GWebMaster2 | Generate, submit sitemaps, and receive feedback from Google Search Console. |
4 | GIndex | Push content updates directly to Google via the Indexing API. |
Commands
1. Generate Sitemap: genmap
The genmap
command generates a sitemap based on the provided --include
and --exclude
patterns. Optionally, it can upload the generated sitemap to an FTP server.
hawk genmap [options]
Options for genmap
Option | Alias | Default | Description |
---|---|---|---|
--commit | -c | false | Upload the generated sitemap.xml file to the FTP server. |
Example Usage
-
Generate a sitemap without uploading:
hawk genmap -i "src/**/*.html" -e "node_modules/**"
-
Generate and upload a sitemap to the FTP server:
hawk genmap -i "src/**/*.html" -c
2. Initialize Configuration: init
The init
command initializes a default configuration file (hawk.config.js
) in the root directory of your project.
hawk init
Example Usage
hawk init
Output:
🚀 Hawk.js configuration initialized.
3. Main Command
If no subcommand is provided, the CLI defaults to employing a strategy for sitemap generation and submission.
hawk [options]
Example Usage
-
Use the IndexNow strategy:
hawk -s 1
Output:
🚀 Hawk employing "IndexNow" strategy...
-
Use the GWebMaster2 strategy
hawk -s 3
Output:
🚀 Hawk employing "GWebMaster2" strategy...
FAQ: Common Questions
What happens if I don’t specify a strategy?
If no valid strategy is provided, the CLI will prompt you to choose one of the supported strategies.
â• Must choose any one number from below:
1. IndexNow
2. G-WebMaster
3. G-WebMaster2
4. G-Index
Can I use multiple strategies in one command?
No. Each CLI invocation applies a single strategy. To use multiple strategies, run separate CLI commands.
Next Steps
Explore more about each strategy:
Keywords:
- Hawk.js CLI
- sitemap generation
- command line tool
- IndexNow
- Google Webmaster
- GWebMaster
- Indexing API
- FTP upload
- CLI commands
- strategy configuration