https://github.com/json-derulo/ngx-sitemaps
Generate sitemaps from Angular prerendered routes
https://github.com/json-derulo/ngx-sitemaps
Last synced: 4 months ago
JSON representation
Generate sitemaps from Angular prerendered routes
- Host: GitHub
- URL: https://github.com/json-derulo/ngx-sitemaps
- Owner: json-derulo
- License: mit
- Created: 2025-05-29T14:42:09.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-05-29T14:49:05.000Z (5 months ago)
- Last Synced: 2025-06-26T01:05:03.729Z (4 months ago)
- Language: TypeScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-angular - ngx-sitemaps - Generate sitemaps from Angular prerendered routes. (Architecture and Advanced Topics / Server-Side Rendering)
- fucking-awesome-angular - ngx-sitemaps - Generate sitemaps from Angular prerendered routes. (Architecture and Advanced Topics / Server-Side Rendering)
README
# ngx-sitemaps
Generate sitemaps from Angular prerendered routes.
## Prerequisites
- Your project is an Angular project
- Your project uses SSR with static site generation (SSG)
## CLI usage
Before using the CLI, make sure to build your application.
Afterward, run the following CLI command to generate the sitemap:
```
npx ngx-sitemaps https://your-site.com
```
To run the script always after the build, install the package in your project
and set up a `postbuild` script in your `package.json`:
```json
{
"scripts": {
"build": "ng build",
"postbuild": "ngx-sitemaps https://your-site.com"
}
}
```
## Direct usage
If you already have a custom postbuild script, you can use the following code to generate the sitemap:
```javascript
import { generateSitemap } from "ngx-sitemaps";
await generateSitemap("https://your-site.com");
```
## Options
| Title | CLI usage | Direct usage | Description |
| ------- | ----------- | ------------ | ---------------------------- |
| Project | `--project` | `project` | Project name in angular.json |