Configurations
Default Template Configuration
/** @type {import("@cresteem/hawk-js").hawkJsOptions} */
const config = {
lookupPatterns: ["**/*.html", "**/*.htm"],
ignorePattern: ["node_modules/**"],
timeZone: "Asia/Kolkata",
domainName: "www.cresteem.com",
sitemapPath: "sitemap.xml",
robotPath: "robot.txt",
serviceAccountFile: "gserv.json",
ftpCredential: { username: "", password: "", hostname: "" },
};
exports.default = config;
This is the default hawk.config.js
configuration file. You can modify the values according to your website’s needs. Here’s a breakdown of each option:
Configuration Breakdown
Setting | Default Value | Description | When It’s Used |
---|---|---|---|
lookupPatterns | [”/*.html”, ”/*.htm”] | Patterns used to identify the HTML files for sitemap generation. | When defining the file types you want Hawk.js to consider for sitemap generation. |
ignorePattern | [“node_modules/**“] | Defines patterns to exclude certain files or directories from sitemap generation. | To exclude unnecessary files or folders (e.g., node_modules , build folders) from the sitemap. |
timeZone | ”Asia/Kolkata” | Timezone used for file timestamps during sitemap generation. | To ensure that file modification timestamps are correctly handled. |
domainName | ”www.cresteem.com” | Your website’s domain name. | Used to construct accurate URLs for your sitemap. |
sitemapPath | ”sitemap.xml” | The filename and path where the generated sitemap will be saved. | Specify the output location for your sitemap file. |
robotPath | ”robot.txt” | The location of your robots.txt file. | If you have a custom robots.txt , specify its path here to help control crawler behavior. |
serviceAccountFile | ”gserv.json” | Points to the service account JSON file used for Google services (required for G-Webmaster , G-WebMaster2 , G-Index ). | Only required when using Google Webmaster Tools such as G-WebMaster, G-Index. |
ftpCredential | username : "", password : "", hostname : "" | FTP credentials needed to upload the sitemap to your server. | Required for submitting your sitemap and hash-key token via FTP for strategy like IndexNow , G-Webmaster , or G-WebMaster2 . |
How to Configure Hawk.js
-
Create
hawk.config.js
:- Create using CLI
hawk init
- Open the
hawk.config.js
file, that will be in the root directory of your project.
-
Customize the Settings:
- Modify the configuration values based on your project needs, including adjusting file patterns, time zone, and credentials.
-
Save Changes:
- After updating the configuration, save the
hawk.config.js
file to apply the new settings to Hawk.js.
- After updating the configuration, save the
Credential Requirements
-
FTP Credentials: If you plan to use IndexNow, G-Webmaster, or G-Webmaster2, you will need to provide FTP credentials (
ftpCredential
), which includeusername
,password
, andhostname
. This allows Hawk.js to automatically upload your generated sitemap to the server. -
Service Account File: This is required for integration with G-Webmaster, G-Webmaster2, or G-Index. The
serviceAccountFile
points to a JSON file containing your Google service credentials, like the one used to connect with the Google Search Console API.
Learn more in the Google Credentials and FTP Credentials.
Next Step ?
Learn About Supported Indexing Strategies
Keywords:
- Hawk.js
- sitemap configuration
- SEO setup
- FTP credentials
- Google Webmaster Tools
- service account
- IndexNow
- configuration tutorial
- SEO optimization
- hawk.config.js