Documentation
¶
Index ¶
- func BuildFuncMap() template.FuncMap
- func GenerateAllEntitiesShareSVG(siteName string, totalCount int, typeDist []NameCount) string
- func GenerateCookModePrompt(e *entity.Entity, enrichment map[string]interface{}, ...) string
- func GenerateEntityShareSVG(siteName, title, category, cuisine, skillLevel string) string
- func GenerateHomepageShareSVG(siteName, description string, taxStats []NameCount, totalEntities int) string
- func GenerateHubShareSVG(siteName, entryName, taxLabel string, count int, topTypes []NameCount) string
- func GenerateLetterShareSVG(siteName, taxLabel, letter string, entryCount int) string
- func GenerateTaxIndexShareSVG(siteName, taxLabel string, topEntries []NameCount) string
- type AllEntitiesPageContext
- type Breadcrumb
- type Engine
- func (e *Engine) RenderAllEntities(ctx AllEntitiesPageContext) (string, error)
- func (e *Engine) RenderCSS() (string, error)
- func (e *Engine) RenderEntity(ctx EntityPageContext) (string, error)
- func (e *Engine) RenderHomepage(ctx HomepageContext) (string, error)
- func (e *Engine) RenderHub(ctx HubPageContext) (string, error)
- func (e *Engine) RenderJS() (string, error)
- func (e *Engine) RenderLetter(ctx LetterPageContext) (string, error)
- func (e *Engine) RenderStatic(templateName string, ctx StaticPageContext) (string, error)
- func (e *Engine) RenderTaxonomyIndex(ctx TaxonomyIndexContext) (string, error)
- type EntityPageContext
- type HomepageContext
- type HubPageContext
- type LetterPageContext
- type NameCount
- type OGMeta
- type StaticPageContext
- type TaxonomyIndexContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFuncMap ¶
BuildFuncMap creates the template FuncMap with all helper functions.
func GenerateAllEntitiesShareSVG ¶
GenerateAllEntitiesShareSVG generates the all-entities share image SVG.
func GenerateCookModePrompt ¶
func GenerateCookModePrompt(e *entity.Entity, enrichment map[string]interface{}, affiliateLinks []affiliate.Link) string
GenerateCookModePrompt builds a cook-with-AI prompt for a recipe.
func GenerateEntityShareSVG ¶
GenerateEntityShareSVG generates the entity share image SVG.
func GenerateHomepageShareSVG ¶
func GenerateHomepageShareSVG(siteName, description string, taxStats []NameCount, totalEntities int) string
GenerateHomepageShareSVG generates the homepage share image SVG.
func GenerateHubShareSVG ¶
func GenerateHubShareSVG(siteName, entryName, taxLabel string, count int, topTypes []NameCount) string
GenerateHubShareSVG generates the hub page share image SVG.
func GenerateLetterShareSVG ¶
GenerateLetterShareSVG generates the letter page share image SVG.
func GenerateTaxIndexShareSVG ¶
GenerateTaxIndexShareSVG generates the taxonomy index share image SVG.
Types ¶
type AllEntitiesPageContext ¶
type AllEntitiesPageContext struct {
Site config.SiteConfig
Entities []*entity.Entity
Pagination taxonomy.PaginationInfo
JsonLD template.HTML
Breadcrumbs []Breadcrumb
AllTaxonomies []taxonomy.Taxonomy
EntityCount int
TotalEntities int
OG OGMeta
ChartData template.JS
CTA config.CTAConfig
}
AllEntitiesPageContext is the template context for the all-entities listing pages.
type Breadcrumb ¶
Breadcrumb is a single breadcrumb entry.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the template rendering engine.
func (*Engine) RenderAllEntities ¶
func (e *Engine) RenderAllEntities(ctx AllEntitiesPageContext) (string, error)
RenderAllEntities renders an all-entities listing page.
func (*Engine) RenderCSS ¶
RenderCSS reads and returns the CSS template content. Uses Tree.Root.String() to avoid html/template escaping in CSS code.
func (*Engine) RenderEntity ¶
func (e *Engine) RenderEntity(ctx EntityPageContext) (string, error)
RenderEntity renders an entity page.
func (*Engine) RenderHomepage ¶
func (e *Engine) RenderHomepage(ctx HomepageContext) (string, error)
RenderHomepage renders the homepage.
func (*Engine) RenderHub ¶
func (e *Engine) RenderHub(ctx HubPageContext) (string, error)
RenderHub renders a taxonomy hub page.
func (*Engine) RenderJS ¶
RenderJS reads and returns the JS template content. Uses Tree.Root.String() to avoid html/template escaping < to < in JS code.
func (*Engine) RenderLetter ¶
func (e *Engine) RenderLetter(ctx LetterPageContext) (string, error)
RenderLetter renders a letter page.
func (*Engine) RenderStatic ¶
func (e *Engine) RenderStatic(templateName string, ctx StaticPageContext) (string, error)
RenderStatic renders a static page.
func (*Engine) RenderTaxonomyIndex ¶
func (e *Engine) RenderTaxonomyIndex(ctx TaxonomyIndexContext) (string, error)
RenderTaxonomyIndex renders a taxonomy index page.
type EntityPageContext ¶
type EntityPageContext struct {
Site config.SiteConfig
Entity *entity.Entity
Slug string
URL string
CanonicalURL string
Breadcrumbs []Breadcrumb
Pairings []*entity.Entity
Enrichment map[string]interface{}
AffiliateLinks []affiliate.Link
CookModePrompt string
JsonLD template.HTML
Taxonomies []taxonomy.Taxonomy
AllTaxonomies []taxonomy.Taxonomy
ValidSlugs map[string]map[string]bool
Contributors map[string]interface{}
OG OGMeta
ChartData template.JS
CTA config.CTAConfig
SourceCode string
SourceLang string
}
EntityPageContext is the template context for entity (recipe) pages.
type HomepageContext ¶
type HomepageContext struct {
Site config.SiteConfig
Entities []*entity.Entity
Taxonomies []taxonomy.Taxonomy
Favorites []*entity.Entity
JsonLD template.HTML
EntityCount int
Contributors map[string]interface{}
OG OGMeta
ChartData template.JS
CTA config.CTAConfig
ArchData template.JS
}
HomepageContext is the template context for the homepage.
type HubPageContext ¶
type HubPageContext struct {
Site config.SiteConfig
Taxonomy taxonomy.Taxonomy
Entry taxonomy.Entry
Entities []*entity.Entity
Pagination taxonomy.PaginationInfo
JsonLD template.HTML
Breadcrumbs []Breadcrumb
AllTaxonomies []taxonomy.Taxonomy
Contributors map[string]interface{}
ContributorProfile map[string]interface{}
OG OGMeta
ChartData template.JS
CTA config.CTAConfig
}
HubPageContext is the template context for taxonomy hub (category) pages.
type LetterPageContext ¶
type LetterPageContext struct {
Site config.SiteConfig
Taxonomy taxonomy.Taxonomy
Letter string
Entries []taxonomy.Entry
Letters []string
JsonLD template.HTML
Breadcrumbs []Breadcrumb
AllTaxonomies []taxonomy.Taxonomy
OG OGMeta
ChartData template.JS
CTA config.CTAConfig
}
LetterPageContext is the template context for A-Z letter pages.
type OGMeta ¶
type OGMeta struct {
Title string
Description string
URL string
ImageURL string
Type string // "website" for homepage, "article" for all others
SiteName string
}
OGMeta holds Open Graph and Twitter Card metadata for a page.
type StaticPageContext ¶
type StaticPageContext struct {
Site config.SiteConfig
Title string
Content template.HTML
JsonLD template.HTML
Breadcrumbs []Breadcrumb
AllTaxonomies []taxonomy.Taxonomy
}
StaticPageContext is the template context for static pages.
type TaxonomyIndexContext ¶
type TaxonomyIndexContext struct {
Site config.SiteConfig
Taxonomy taxonomy.Taxonomy
Entries []taxonomy.Entry
TopEntries []taxonomy.Entry
LetterGroups []taxonomy.LetterGroup
HasLetters bool
Letters []string
JsonLD template.HTML
Breadcrumbs []Breadcrumb
AllTaxonomies []taxonomy.Taxonomy
OG OGMeta
ChartData template.JS
CTA config.CTAConfig
}
TaxonomyIndexContext is the template context for taxonomy index pages.