Documentation
¶
Overview ¶
Package generator handles static site generation
Package generator - templates.go contains default HTML templates
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Source string
Template string
Domain string
ContentDir string
TemplatesDir string
OutputDir string
// New options
SitemapOff bool // Disable sitemap generation
RobotsOff bool // Disable robots.txt generation
PrettyHTML bool // Prettify HTML output (remove extra blank lines)
PostURLFormat string // Post URL format: "date" (/YYYY/MM/DD/slug/) or "slug" (/slug/)
PageFormat string // Page output format: "directory" (slug/index.html), "flat" (slug.html), "both"
RelativeLinks bool // Convert absolute URLs to relative links
Shortcodes []Shortcode // Shortcodes definitions
ShortcodeBrackets bool // Also match [shortcode] syntax
MinifyHTML bool // Minify HTML output
MinifyCSS bool // Minify CSS output
MinifyJS bool // Minify JS output
SourceMap bool // Include source maps
Clean bool // Clean output directory before build
Quiet bool // Suppress stdout output
Engine string // Template engine: go, pongo2, mustache, handlebars
// MDDB content source
Mddb MddbConfig // MDDB configuration
// Variables defines custom variables available in all templates as {{.Vars.key}}
// and exported as environment variables with SSG_ prefix (e.g. SSG_GTM).
// Values starting with $ are resolved from the current environment (e.g. "$GTM_CODE").
Variables map[string]interface{}
// PagesPath is the subdirectory name inside source for static pages (default: "pages")
PagesPath string
// PostsPath is the subdirectory name inside source for blog posts (default: "posts")
PostsPath string
// RewriteMdLinks rewrites relative .md links in content to their final output URLs (opt-in)
RewriteMdLinks bool
// PreserveSlugCase keeps original casing in slugs derived from filenames.
// Default (false): slugs lowercased. When true: original case preserved.
PreserveSlugCase bool
}
Config holds generator configuration
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator handles the static site generation process
type MddbConfig ¶ added in v1.6.0
type MddbConfig struct {
Enabled bool // Enable mddb as content source
URL string // Base URL (e.g., "http://localhost:11023" or "localhost:11024" for gRPC)
Protocol string // Connection protocol: "http" (default) or "grpc"
APIKey string // Optional API key
Collection string // Collection name for content
Lang string // Language filter (e.g., "en_US")
Timeout int // Request timeout in seconds
BatchSize int // Batch size for pagination (default: 1000)
Watch bool // Enable watch mode for MDDB changes
WatchInterval int // Watch interval in seconds (default: 30)
}
MddbConfig holds MDDB connection settings for generator
type Shortcode ¶ added in v1.5.4
type Shortcode struct {
Name string // Shortcode name (e.g., "thunderpick")
Type string // Type for template logic (e.g., "banner")
Template string // Template file (required)
Title string // Title/heading
Text string // Text content
Url string // Link URL
Logo string // Logo/image path
Legal string // Legal text
Ranking float64 // Ranking score (e.g., 3.5)
Tags []string // Tags for categorization (e.g., ["game", "public"])
Data map[string]string // Additional custom data
// Runtime fields (set per-invocation from inline attributes/content)
Attrs map[string]string // Inline attributes from [name key="val"]
InnerContent string // Content between [name]...[/name]
}
Shortcode defines a reusable content snippet
Click to show internal directories.
Click to hide internal directories.