Skip to content

Template Data

Every template receives a TemplateData struct. Theme authors can rely on these fields.

Top-Level Fields

FieldTypeAvailable InDescription
.SiteSiteConfigAll pagesTitle, tagline, author, social links, footer, feature toggles
.MetaSEOMetaAll pagesTitle, description, canonical URL, OG data
.NavNavDataAll pagesCurrent path, active section
.Post*Postpost.htmlSingle post
.Posts[]Posthome, tag, archivePost list
.Page*Pagepage.htmlStatic page
.Tags[]TagInfoAll pagesAll tags with counts
.Tag*TagInfotag.htmlCurrent tag
.Stats*PostStatspost.htmlViews, likes, dislikes
.Comments[]Commentpost.htmlApproved comments
.Pagination*Paginationhome.htmlPage numbers, prev/next
.CSRFTokenstringAll pagesCSRF token for forms
.YearintAll pagesCurrent year
.ErrorstringError pagesError message
.RelatedPosts[]Postpost.htmlPosts with shared tags
.SearchQuerystringsearch.htmlCurrent query
.SearchResults[]Postsearch.htmlResults
.Webmentions[]Webmentionpost.htmlVerified webmentions
.FediAddressstringAll pagese.g. @blog@example.com
.TableOfContents[]TOCEntrypost.htmlHeadings for ToC
.SeriesPosts[]Postpost.htmlAll posts in same series

Post Fields

FieldTypeDescription
.TitlestringPost title
.SlugstringURL slug
.Datetime.TimePublication date
.Tags[]stringTag names
.DescriptionstringSEO description
.ImagestringFeatured image filename
.FeaturedboolFeatured flag
.DraftboolDraft flag
.TOCboolShow table of contents
.SeriesstringSeries name
.SeriesOrderintPosition in series
.ContentstringRaw markdown
.HTMLstringRendered HTML (use {{safeHTML .HTML}})
.ReadingTimeintEstimated minutes
.WordCountintWord count
.PermalinkstringURL path

Site Config Fields

FieldDescription
.Site.TitleBlog title
.Site.TaglineBlog tagline
.Site.BaseURLCanonical base URL
.Site.ThemeActive theme name
.Site.LocaleLanguage code
.Site.Author.NameAuthor name
.Site.Author.BioAuthor biography
.Site.Author.AvatarAvatar image path
.Site.Social.GithubGitHub username
.Site.Social.TwitterTwitter username
.Site.ActivityPubEnabledAP toggle
.Site.WebmentionEnabledWM toggle
.Site.IndieAuthEnabledIA toggle
.Site.MicropubEnabledMP toggle

Released under the MIT License.