site

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DerivePagesBasePath

func DerivePagesBasePath(repositoryName string) string

DerivePagesBasePath derives a GitHub project Pages path from a repository name.

func FindProjectRoot

func FindProjectRoot(start string) (string, error)

FindProjectRoot searches upward for the module definition.

func FindUnresolvedPlaceholders

func FindUnresolvedPlaceholders(outputDir string) []string

FindUnresolvedPlaceholders finds template markers and stale identities in generated text files.

func Manifest

func Manifest(cfg SiteConfig) ([]byte, error)

Manifest renders the installable website manifest from central identity.

func Preview

func Preview(projectRoot string, cfg SiteConfig, address string) error

Preview builds, validates, and serves the production-like artifact below its Pages base path.

func ProductionURL

func ProductionURL(owner, repositoryName string) string

ProductionURL derives the canonical GitHub Pages URL for a project repository.

func Robots

func Robots(cfg SiteConfig) string

Robots renders the crawler policy for the production site.

func ServiceWorker

func ServiceWorker(cfg SiteConfig, version string, precache []string) string

ServiceWorker generates a project-scoped worker with network-first HTML and cache-first assets.

func Sitemap

func Sitemap(cfg SiteConfig) string

Sitemap renders exactly the configured public page URLs.

Types

type APIDocumentation

type APIDocumentation struct {
	PackageName string
	ImportPath  string
	Doc         string
	Items       []APIItem
}

APIDocumentation is the exported API extracted from the root Go package.

func ExtractAPI

func ExtractAPI(projectRoot, importPath string) (APIDocumentation, error)

ExtractAPI parses the root package and returns documentation for exported declarations only.

type APIItem

type APIItem struct {
	Name      string
	Anchor    string
	Kind      string
	Signature string
	Doc       string
}

APIItem is one exported declaration rendered on the API page.

type BuildResult

type BuildResult struct {
	OutputDir string
	Pages     int
	Assets    int
	Version   string
}

BuildResult describes a completed deterministic Pages build.

func Build

func Build(projectRoot string, cfg SiteConfig) (BuildResult, error)

Build creates the complete GitHub Pages artifact from source templates and the public Go API.

type PageConfig

type PageConfig struct {
	Name        string
	OutputPath  string
	Path        string
	Title       string
	Description string
	SchemaType  string
}

PageConfig owns the unique identity and production location of one public page.

type PageMetadata

type PageMetadata struct {
	Title       string
	Description string
	Canonical   string
	OGType      string
	SiteName    string
	OGImage     string
	OGImageAlt  string
	JSONLD      template.JS
}

PageMetadata contains the generated SEO and structured-data identity for a page.

func Metadata

func Metadata(cfg SiteConfig, page PageConfig) (PageMetadata, error)

Metadata creates page-specific metadata from the central configuration.

type PrimaryPalette

type PrimaryPalette struct {
	Base     string `json:"base"`
	Hover    string `json:"hover"`
	Active   string `json:"active"`
	Soft     string `json:"soft"`
	RGB      string `json:"rgb"`
	HoverRGB string `json:"hoverRgb"`
}

PrimaryPalette defines interactive and soft-accent colors for one mode.

type SiteConfig

type SiteConfig struct {
	PackageName     string
	DisplayName     string
	ModulePath      string
	Description     string
	RepositoryOwner string
	RepositoryName  string
	RepositoryURL   string
	PagesBasePath   string
	PagesURL        string
	Theme           ThemeConfig
	CachePrefix     string
	PWAShortName    string
	GoVersion       string
	License         string
	OutputDir       string
	SiteSourceDir   string
	Favicon         string
	Icon192         string
	Icon512         string
	MaskableIcon512 string
	AppleTouchIcon  string
	OpenGraphImage  string
	Pages           []PageConfig
}

SiteConfig is the build-time source of truth for project, website, SEO, theme, and PWA identity. It belongs to internal tooling and is not part of the public package API.

func LoadConfig

func LoadConfig(projectRoot string) (SiteConfig, error)

LoadConfig reads the editable site.config.json file and derives deployment-specific values.

func (SiteConfig) AssetURL

func (c SiteConfig) AssetURL(assetPath string) string

AssetURL returns a repository-subpath-aware URL for a generated asset.

func (SiteConfig) CanonicalURL

func (c SiteConfig) CanonicalURL(page PageConfig) string

CanonicalURL returns the absolute production URL for page.

func (SiteConfig) Page

func (c SiteConfig) Page(name string) (PageConfig, bool)

Page finds a configured page by name.

func (SiteConfig) Validate

func (c SiteConfig) Validate() error

Validate checks invariants needed by generation and deployment.

type ThemeConfig

type ThemeConfig struct {
	StorageKey string       `json:"-"`
	ColorLight string       `json:"colorLight"`
	ColorDark  string       `json:"colorDark"`
	Primary    ThemePalette `json:"primary"`
}

ThemeConfig owns the website color modes and persisted preference identity.

type ThemePalette

type ThemePalette struct {
	Light PrimaryPalette `json:"light"`
	Dark  PrimaryPalette `json:"dark"`
}

ThemePalette contains the coordinated primary colors for both Bootstrap modes.

type ValidationResult

type ValidationResult struct {
	OutputDir string
	Pages     int
	Links     int
	Icons     int
}

ValidationResult summarizes final-artifact checks.

func ValidateArtifact

func ValidateArtifact(projectRoot string, cfg SiteConfig) (ValidationResult, error)

ValidateArtifact validates the generated Pages artifact rather than source templates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL