Documentation
¶
Index ¶
- func Get(collectionName, slug string) map[string]interface{}
- func GetCollection(collectionName string) []map[string]interface{}
- type BlogPost
- type CollectionConfig
- type CollectionType
- type Collections
- func (c *Collections) ClearCache()
- func (c *Collections) DefineCollection(name string, config CollectionConfig)
- func (c *Collections) GetCollection(name string) ([]*Entry, error)
- func (c *Collections) GetEntry(collectionName, slug string) (*Entry, error)
- func (c *Collections) Render(entry *Entry) (string, error)
- type ContentAPI
- type Entry
- type FieldType
- type GetStaticPathsFunc
- type Schema
- type StaticPath
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCollection ¶
GetCollection is a helper function for use in codegen mode
Types ¶
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)
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) GetStringSlice ¶
type GetStaticPathsFunc ¶
type GetStaticPathsFunc func() ([]StaticPath, error)
type StaticPath ¶
func GetStaticPathsFromCollection ¶
func GetStaticPathsFromCollection(collectionName string, collections *Collections, paramName string) ([]StaticPath, error)
func GetStaticPathsFromEntries ¶
func GetStaticPathsFromEntries(entries []*Entry, paramName string) []StaticPath
Click to show internal directories.
Click to hide internal directories.