template

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteHTML

func WriteHTML(outputPath string, content string) error

WriteHTML writes HTML content to a file

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine handles template loading and rendering

func New

func New(cfg config.Config) (*Engine, error)

New creates a new template engine

func (*Engine) RenderIndex

func (e *Engine) RenderIndex(posts models.PostList, page int, totalPages int) (string, error)

RenderIndex renders an index/list page with pagination

func (*Engine) RenderPost

func (e *Engine) RenderPost(post *models.Post) (string, error)

RenderPost renders a single post page

func (*Engine) RenderTag

func (e *Engine) RenderTag(tag string, posts models.PostList, allPosts models.PostList) (string, error)

RenderTag renders a tag page

type IndexData

type IndexData struct {
	Posts      models.PostList
	Site       config.SiteMetadata
	BlogPath   string
	Page       int
	TotalPages int
	HasNext    bool
	HasPrev    bool
	AllTags    []string
}

IndexData holds data for rendering an index page

type PostData

type PostData struct {
	Post     *models.Post
	Site     config.SiteMetadata
	BlogPath string
}

PostData holds data for rendering a post page

type TagData

type TagData struct {
	Tag      string
	Posts    models.PostList
	Site     config.SiteMetadata
	BlogPath string
	AllTags  []string
}

TagData holds data for rendering a tag page

Jump to

Keyboard shortcuts

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