blog

package
v1.16.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostsFS embed.FS

Functions

func AtomFeed

func AtomFeed(posts []Post, baseURL string) (string, error)

func RenderIndex

func RenderIndex(p *pages.Pages, templatesDir string, posts []Post, w io.Writer) error

RenderIndex renders the blog index page to w.

func RenderPost

func RenderPost(p *pages.Pages, templatesDir string, post Post, w io.Writer) error

RenderPost renders a single blog post page to w.

Types

type Author

type Author struct {
	Name   string `yaml:"name"`
	Email  string `yaml:"email"`
	Handle string `yaml:"handle"`
}

type Post

type Post struct {
	Meta PostMeta
	Body template.HTML
}

func AllPosts

func AllPosts(postsDir string) ([]Post, error)

AllPosts parses and returns all posts including drafts, sorted newest-first.

func Posts

func Posts(postsDir string) ([]Post, error)

Posts parses and returns all non-draft posts sorted newest-first.

func (Post) ParsedDate

func (p Post) ParsedDate() time.Time

type PostMeta

type PostMeta struct {
	Slug     string   `yaml:"slug"`
	Title    string   `yaml:"title"`
	Subtitle string   `yaml:"subtitle"`
	Date     string   `yaml:"date"`
	Authors  []Author `yaml:"authors"`
	Image    string   `yaml:"image"`
	Draft    bool     `yaml:"draft"`
}

Source Files

  • blog.go

Jump to

Keyboard shortcuts

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