content

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(collectionName, slug string) map[string]interface{}

Get is a helper function for use in codegen mode

func GetCollection

func GetCollection(collectionName string) []map[string]interface{}

GetCollection is a helper function for use in codegen mode

Types

type BlogPost

type BlogPost struct {
	Title       string
	Description string
	PubDate     time.Time
	Author      string
	Tags        []string
	Draft       bool
}

type CollectionConfig

type CollectionConfig struct {
	Type   CollectionType
	Schema Schema
}

type CollectionType

type CollectionType string
const (
	CollectionTypeContent CollectionType = "content"
	CollectionTypeData    CollectionType = "data"
)

type Collections

type Collections struct {
	ContentDir string
	// contains filtered or unexported fields
}

func NewCollections

func NewCollections(contentDir string) *Collections

func (*Collections) ClearCache

func (c *Collections) ClearCache()

func (*Collections) DefineCollection

func (c *Collections) DefineCollection(name string, config CollectionConfig)

func (*Collections) GetCollection

func (c *Collections) GetCollection(name string) ([]*Entry, error)

func (*Collections) GetEntry

func (c *Collections) GetEntry(collectionName, slug string) (*Entry, error)

func (*Collections) Render

func (c *Collections) Render(entry *Entry) (string, error)

type ContentAPI

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

func NewContentAPI

func NewContentAPI(redirectFunc func(string, int)) *ContentAPI

func (*ContentAPI) Get

func (c *ContentAPI) Get(collectionName, slug string) map[string]interface{}

func (*ContentAPI) GetCollection

func (c *ContentAPI) GetCollection(collectionName string) []map[string]interface{}

type Entry

type Entry struct {
	ID         string
	Slug       string
	Collection string
	Data       map[string]interface{}
	Body       string
	FilePath   string
	RawContent string
}

func (*Entry) GetBool

func (e *Entry) GetBool(key string) bool

func (*Entry) GetInt

func (e *Entry) GetInt(key string) int

func (*Entry) GetString

func (e *Entry) GetString(key string) string

func (*Entry) GetStringSlice

func (e *Entry) GetStringSlice(key string) []string

type FieldType

type FieldType struct {
	Type     string
	Required bool
}

type GetStaticPathsFunc

type GetStaticPathsFunc func() ([]StaticPath, error)

type Schema

type Schema struct {
	Fields map[string]FieldType
}

type StaticPath

type StaticPath struct {
	Params map[string]string
	Props  map[string]interface{}
}

func GetStaticPathsFromCollection

func GetStaticPathsFromCollection(collectionName string, collections *Collections, paramName string) ([]StaticPath, error)

func GetStaticPathsFromEntries

func GetStaticPathsFromEntries(entries []*Entry, paramName string) []StaticPath

Jump to

Keyboard shortcuts

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