Documentation
¶
Overview ¶
Package shard splits a tago/hugo build output into per-subdomain deployments. It copies files, rewrites URLs, splits search data, generates sitemaps, and writes Cloudflare Pages _redirects files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is the parsed deploy-shards.toml.
func ParseConfig ¶
ParseConfig parses a deploy-shards.toml byte slice.
type Options ¶
type Options struct {
ConfigFile string // path to deploy-shards.toml (default: deploy-shards.toml)
PublicDir string // path to built public/ dir (default: public)
ContentRoot string // for lastmods path mapping (default: content/en)
LastmodsFile string // incremental cache (default: content-lastmods.json)
SummaryFile string // JSON summary output (default: deploy-shards-summary.json)
Incremental bool // use manifest-based change detection; falls back to full split on miss
ManifestFile string // path to public/ size manifest (default: public-manifest.json)
}
Options controls the Split operation.
type Site ¶
type Site struct {
Name string // "main", "leetcode", …
Project string // Cloudflare Pages project name
Domain string // e.g. "brain.tamnd.com"
Output string // destination directory
FileBudget int // max files allowed (0 = unlimited)
SourcePrefix string // e.g. "/practice/kvant/" — empty for main
RangeMin int // lower bound (inclusive) on the numeric first path
RangeMax int // segment under SourcePrefix; 0/0 = whole subtree.
}
Site describes one Cloudflare Pages deployment target.
type SiteSummary ¶
type SiteSummary struct {
Site string `json:"site"`
Domain string `json:"domain"`
Project string `json:"project"`
Files int `json:"files"`
Bytes int64 `json:"bytes"`
}
SiteSummary is one entry in the JSON summary written after a split.
func Split ¶
func Split(opts Options) ([]SiteSummary, error)
Split is the full pipeline: copy → clean → rewrite → search → redirects → sitemaps → validate. It mirrors split_cloudflare_pages_shards.py but runs the URL-rewrite step in parallel Go goroutines (typically 6–10× faster).