https://github.com/lelabdev/gositemap
A blazing-fast, test-driven sitemap.xml generator for static SvelteKit sites. SEO-ready, TOML-configurable, and CI/CD friendly
https://github.com/lelabdev/gositemap
Last synced: 4 months ago
JSON representation
A blazing-fast, test-driven sitemap.xml generator for static SvelteKit sites. SEO-ready, TOML-configurable, and CI/CD friendly
- Host: GitHub
- URL: https://github.com/lelabdev/gositemap
- Owner: lelabdev
- Created: 2025-07-18T19:33:03.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-26T18:52:18.000Z (11 months ago)
- Last Synced: 2025-07-26T22:04:45.782Z (11 months ago)
- Language: Go
- Size: 14.6 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GoSitemap [](https://github.com/lelabdev/gositemap/releases/latest)
**GoSitemap** is a fast and minimal sitemap generator tailored for static **SvelteKit** sites.
Itβs built with simplicity, performance, and automation in mind β perfect for CI/CD or local use.
---
## π₯ What It Does
- Scans your SvelteKit `src/routes/` folder for all **static pages**
- Parses `.md` and `.svx` articles in `src/lib/content/` or any folder you define
- Builds a clean `sitemap.xml` with `` and optional ``
- Uses a single config file: `gositemap.toml` (can be auto-generated on first run)
- Outputs a ready-to-serve `static/sitemap.xml`
- 100% static, no server needed
- Built in Go β fast, lightweight, and dependency-free
---
## π How to Use
1. Put a `gositemap.toml` at your project root
(or just run the tool and itβll ask you interactively)
2. Run GoSitemap:
```sh
go run .
# or build:
go build && ./gositemap
```
3. Your sitemap will be created at:
static/sitemap.xml
---
βοΈ CLI Options
`--help`, `-h` Show help and example config, then exit
`--dry-run` Output sitemap to stdout only
`--quiet` Suppress logs except errors
`preserve_existing` (in `gositemap.toml`) Controls how existing sitemap.xml files are handled.
---
## π Sitemap Overwrite Behavior (`preserve_existing`)
GoSitemap offers flexible control over how it updates your `sitemap.xml` file:
- **Default Behavior (or `preserve_existing = true` in `gositemap.toml`):**
If a `sitemap.xml` file already exists, GoSitemap will **add only new entries** to it. Existing entries (and their `` dates) will be preserved and *not* updated. This is ideal for incremental updates where you want to maintain historical `` values.
- **Explicit Overwrite (`preserve_existing = false` in `gositemap.toml`):**
If `preserve_existing` is explicitly set to `false`, GoSitemap will **regenerate the entire `sitemap.xml` file**. All entries, including existing ones, will have their `` dates updated based on the current scan. Use this when you want a fresh sitemap reflecting the latest modification times for all content.
---
π§ Example gositemap.toml
```toml
base_url = "https://yoursite.com"
preserve_existing = true # Set to false to overwrite all entries and update lastmod dates
[content_types]
blog = "src/lib/content"
portfolio = "src/lib/portfolio"
# You can also use glob patterns to specify content directories.
# The slug will be the basename of the directory.
[[glob]]
paths = [
"src/content/*"
]
[changefreq]
blog = "weekly"
portfolio = "monthly"
about = "yearly"
exclude = [
"/admin",
"/secret"
]
```
---
β¨ Sample Output
```xml
https://yoursite.com/
2023-07-01
https://yoursite.com/blog/article1
2023-07-01
weekly
```
---
π§© How It Works
Static pages: Finds all `+page.svelte` or `article.md` files in `src/routes/`
Articles: Includes `.md` / `.svx` from `content_types` folders
Exclusions: Ignores dynamic/param folders and anything in `exclude`.
- If an exclusion starts with `/`, it's treated as a full path prefix (e.g., `/admin` excludes `/admin` and `/admin/users`).
- Otherwise, it matches any directory segment in the URL (e.g., `(flow)` excludes `/blog/(flow)/post`).
lastmod: Uses `publishDate` (if found) or file mtime
changefreq: Defaults to never, customizable via [changefreq]
URL Order: Root β top-level pages β articles β subpages
---
## π₯ Installation
Download the binary for your OS from the [latest release](https://github.com/lelab/GoSitemap/releases/latest),
then make it executable (on Linux/macOS):
```sh
chmod +x gositemap
./gositemap
```
---
π¦ Downloads
Grab the latest release:
β‘οΈ [Latest Release](https://github.com/lelabdev/gositemap/releases/latest)
Each binary is compiled with optimizations for minimal size.
The version is embedded directly into the binary (-ldflags), no suffix needed.
---
β
Requirements
Go 1.21 or newer
SvelteKit static site structure (uses /static, /routes, etc.)
---
π€ Why GoSitemap?
Super light, no runtime dependencies
No YAML/JSON mess β config is TOML and explicit
CLI-first: works locally or in your CI
Clean, readable sitemap output
Works out of the box with SvelteKit projects
---
π¬ FAQ
How do I change the per type?
Use the [changefreq] section in your TOML.
My page is missing from the sitemap!
Check if itβs dynamic (e.g. [slug]), in parentheses, or listed in exclude.
How to rename /blog/ to something else?
Just change the key in [content_types]:
articles = "src/lib/content"
β This gives /articles/my-post.
My base_url is invalid!
It should start with http:// or https://, and no trailing slash.
---
πͺͺ License
MIT
---
Built for real-world static SvelteKit sites.
Scriptable. Predictable. No fluff.