Documentation
¶
Index ¶
- func BuildCollections(pages []*content.Page, permalinkCfg map[string]string, ...) map[string]*Collection
- func BuildCollectionsWithMode(pages []*content.Page, permalinkCfg map[string]string, ...) map[string]*Collection
- func BuildTaxonomies(pages []*content.Page, taxonomyCfg map[string]*config.TaxonomyConfig) map[string]*TaxonomyCollection
- func DetectDuplicateTermSlugs(taxonomy *TaxonomyCollection) []string
- func GenerateTaxonomyPages(taxonomy *TaxonomyCollection, cfg *config.TaxonomyConfig) []*content.Page
- func SortByFrontMatter(pages []*content.Page, field string, order string) []*content.Page
- func SortPages(pages []*content.Page, sortBy string, order string) []*content.Page
- type Collection
- type TaxonomyCollection
- type TaxonomyPageContext
- type TaxonomyTerm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCollections ¶
func BuildCollections(pages []*content.Page, permalinkCfg map[string]string, collectionNames []string) map[string]*Collection
BuildCollections creates section collections from pages. A section becomes a collection if its permalink pattern contains date tokens (:year, :month, :day) OR it is listed in collectionNames. collectionNames may be nil. Draft pages are excluded.
func BuildCollectionsWithMode ¶
func BuildCollectionsWithMode(pages []*content.Page, permalinkCfg map[string]string, collectionNames []string, devMode bool) map[string]*Collection
BuildCollectionsWithMode builds collections with lifecycle filtering based on mode. devMode=true includes drafts; devMode=false excludes them. collectionNames lists sections that are explicitly declared as collections.
func BuildTaxonomies ¶
func BuildTaxonomies(pages []*content.Page, taxonomyCfg map[string]*config.TaxonomyConfig) map[string]*TaxonomyCollection
BuildTaxonomies creates taxonomy collections from page front matter. Only taxonomy keys declared in taxonomyCfg are collected.
func DetectDuplicateTermSlugs ¶
func DetectDuplicateTermSlugs(taxonomy *TaxonomyCollection) []string
DetectDuplicateTermSlugs checks for taxonomy terms that produce the same URL slug from different source values (e.g., "C++" and "c--" both → "c"). Also detects terms whose slugs are prefixes of each other, which would cause URL routing conflicts.
func GenerateTaxonomyPages ¶
func GenerateTaxonomyPages(taxonomy *TaxonomyCollection, cfg *config.TaxonomyConfig) []*content.Page
GenerateTaxonomyPages creates the virtual index and term pages for a taxonomy.
func SortByFrontMatter ¶
SortByFrontMatter sorts pages by a front matter field value. Used for custom sort fields like "weight", "title", etc.
Types ¶
type Collection ¶
type Collection struct {
Name string
Pages []*content.Page
// contains filtered or unexported fields
}
Collection represents a group of related pages (e.g., blog posts).
func (*Collection) AddPage ¶
func (c *Collection) AddPage(page *content.Page) error
AddPage appends a page to the collection. Returns error if frozen.
func (*Collection) Freeze ¶
func (c *Collection) Freeze()
Freeze marks a collection as read-only. After freezing, any attempt to modify Pages should return an error.
func (*Collection) IsFrozen ¶
func (c *Collection) IsFrozen() bool
IsFrozen returns whether the collection has been frozen.
type TaxonomyCollection ¶
TaxonomyCollection represents a taxonomy with its terms and pages.
type TaxonomyPageContext ¶
type TaxonomyPageContext struct {
// Term is the current term being rendered (empty for index pages).
Term string
// Terms is the list of all terms (for index pages).
Terms []TaxonomyTerm
// Pages is the list of pages for the current term (for term pages).
Pages []*content.Page
}
TaxonomyPageContext holds the template context for taxonomy page rendering. The template receives this as the "taxonomy" object.
func BuildTaxonomyPageContext ¶
func BuildTaxonomyPageContext(taxonomy *TaxonomyCollection, term string) *TaxonomyPageContext
BuildTaxonomyPageContext creates the template context for a taxonomy page. For index pages (term=""), it provides Terms. For term pages, it provides Pages.
func (*TaxonomyPageContext) ToMap ¶
func (ctx *TaxonomyPageContext) ToMap() map[string]interface{}
ToMap converts the context to a map with lowercase keys for reliable template access (avoids liquidgo acronym-mapping issues with struct fields).