Documentation ¶
Index ¶
- func OpenFileForWriting(fs afero.Fs, filename string) (afero.File, error)
- type Collator
- type Data
- type Language
- func (l *Language) Collator() *collate.Collator
- func (l *Language) CurrentLanguageIndex() int
- func (l *Language) Lang() string
- func (l *Language) LanguageCode() string
- func (l *Language) LanguageDirection() string
- func (l *Language) LanguageName() string
- func (l *Language) LanguagePrefix() string
- func (l *Language) Languages() []Language
- func (l *Language) Location() *time.Location
- type Navigation
- type OrderedTaxonomy
- type OrderedTaxonomyEntry
- type Page
- func (p *Page) Content() (any, error)
- func (p *Page) Data() any
- func (p *Page) Date() time.Time
- func (p *Page) ExpiryDate() time.Time
- func (p *Page) File() contenthub.File
- func (p *Page) GetTerms(taxonomy string) []*Page
- func (p *Page) GitInfo() valueobject.GitInfo
- func (p *Page) IsAncestor(other any) bool
- func (p *Page) Language() struct{ ... }
- func (p *Page) Lastmod() time.Time
- func (p *Page) LinkTitle() string
- func (p *Page) OutputFormats() valueobject.OutputFormats
- func (p *Page) Pages() []*Page
- func (p *Page) Paginate(groups contenthub.PageGroups) (*SitePager, error)
- func (p *Page) Paginator() (*SitePager, error)
- func (p *Page) Params() maps.Params
- func (p *Page) Parent() *Page
- func (p *Page) Permalink() string
- func (p *Page) Plain() string
- func (p *Page) PublishDate() time.Time
- func (p *Page) RelPermalink() string
- func (p *Page) Resources() PageResources
- func (p *Page) Section() string
- func (p *Page) Sites() *Sites
- func (p *Page) Title() string
- func (p *Page) Translations() []*Page
- type PageResources
- type Pages
- type Publisher
- type Ref
- type Render
- type Site
- func (s *Site) AbsURL(in string) string
- func (s *Site) Build(t site.Template) error
- func (s *Site) GetPage(ref ...string) (*Page, error)
- func (s *Site) Home() *Page
- func (s *Site) IsMultiLingual() bool
- func (s *Site) IsMultihost() bool
- func (s *Site) IsMultilingual() bool
- func (s *Site) Menus() valueobject.Menus
- func (s *Site) Pages() []*Page
- func (s *Site) Params() maps.Params
- func (s *Site) PrepareLazyLoads()
- func (s *Site) RegularPages() []*Page
- func (s *Site) RelURL(in string) string
- func (s *Site) Taxonomies() TaxonomyList
- func (s *Site) Translate(ctx context.Context, translationID string, templateData any) string
- type SitePager
- type Sites
- type Taxonomy
- type TaxonomyList
- type URL
- type WeightedPage
- type WeightedPages
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collator ¶
func (*Collator) CompareStrings ¶
CompareStrings compares a and b. It returns -1 if a < b, 1 if a > b and 0 if a == b. Note that the Collator is not thread safe, so you may want to acquire a lock on it before calling this method.
type Language ¶
type Language struct { LangSvc site.LanguageService // contains filtered or unexported fields }
func (*Language) CurrentLanguageIndex ¶
func (*Language) LanguageCode ¶
func (*Language) LanguageDirection ¶
func (*Language) LanguageName ¶
func (*Language) LanguagePrefix ¶
type Navigation ¶
type Navigation struct {
// contains filtered or unexported fields
}
type OrderedTaxonomy ¶ added in v0.0.13
type OrderedTaxonomy []OrderedTaxonomyEntry
OrderedTaxonomy is another representation of an Taxonomy using an array rather than a map. Important because you can't order a map.
type OrderedTaxonomyEntry ¶ added in v0.0.13
type OrderedTaxonomyEntry struct { Name string WeightedPages }
OrderedTaxonomyEntry is similar to an element of a Taxonomy, but with the key embedded (as name) e.g: {Name: Technology, WeightedPages: TaxonomyPages}
func (OrderedTaxonomyEntry) Count ¶ added in v0.0.14
func (ie OrderedTaxonomyEntry) Count() int
Count returns the count the pages in this taxonomy.
func (OrderedTaxonomyEntry) Term ¶ added in v0.0.14
func (ie OrderedTaxonomyEntry) Term() string
Term returns the name given to this taxonomy.
type Page ¶
type Page struct { contenthub.Page contenthub.PageOutput *Site // contains filtered or unexported fields }
func (*Page) ExpiryDate ¶
func (*Page) File ¶
func (p *Page) File() contenthub.File
func (*Page) GitInfo ¶
func (p *Page) GitInfo() valueobject.GitInfo
func (*Page) IsAncestor ¶
func (*Page) OutputFormats ¶
func (p *Page) OutputFormats() valueobject.OutputFormats
func (*Page) Paginate ¶ added in v0.1.1
func (p *Page) Paginate(groups contenthub.PageGroups) (*SitePager, error)
func (*Page) PublishDate ¶
func (*Page) RelPermalink ¶
func (*Page) Resources ¶
func (p *Page) Resources() PageResources
func (*Page) Translations ¶
type PageResources ¶
func (PageResources) ByType ¶
func (r PageResources) ByType(typ any) PageResources
ByType returns resources of a given resource type (e.g. "image").
type Publisher ¶
func (*Publisher) Publish ¶
func (p *Publisher) Publish(d site.Descriptor) error
Publish applies any relevant transformations and writes the file to its destination, e.g. /public.
func (*Publisher) PublishFiles ¶
func (p *Publisher) PublishFiles(fr io.ReadSeekCloser, filenames ...string) error
type Ref ¶ added in v0.1.1
type Ref struct { Site *Site ContentSvc site.ContentService NotFoundURL string ErrorLogger logg.LevelLogger }
type Site ¶
type Site struct { ConfigSvc site.ConfigService ContentSvc site.ContentService TranslationSvc site.TranslationService ResourcesSvc site.ResourceService LanguageSvc site.LanguageService GitSvc *valueobject.GitMap Publisher *Publisher Template site.Template *valueobject.Author *valueobject.Compiler Title string *URL *Ref *Language Log loggers.Logger `json:"-"` // contains filtered or unexported fields }
func (*Site) IsMultiLingual ¶
func (*Site) IsMultihost ¶ added in v0.1.1
func (*Site) IsMultilingual ¶ added in v0.1.1
func (*Site) Menus ¶
func (s *Site) Menus() valueobject.Menus
func (*Site) PrepareLazyLoads ¶
func (s *Site) PrepareLazyLoads()
func (*Site) RegularPages ¶ added in v0.0.5
func (*Site) Taxonomies ¶
func (s *Site) Taxonomies() TaxonomyList
type SitePager ¶ added in v0.1.1
type SitePager struct { contenthub.Pager // contains filtered or unexported fields }
type Taxonomy ¶
type Taxonomy map[string]WeightedPages
A Taxonomy is a map of keywords to a list of pages. For example
TagTaxonomy['technology'] = WeightedPages TagTaxonomy['go'] = WeightedPages
func (Taxonomy) ByCount ¶ added in v0.0.13
func (i Taxonomy) ByCount() OrderedTaxonomy
ByCount returns an ordered taxonomy sorted by # of pages per key. If taxonomies have the same # of pages, sort them alphabetical
func (Taxonomy) TaxonomyArray ¶ added in v0.0.13
func (i Taxonomy) TaxonomyArray() OrderedTaxonomy
TaxonomyArray returns an ordered taxonomy with a non defined order.
type TaxonomyList ¶
The TaxonomyList is a list of all taxonomies and their values e.g. List['tags'] => TagTaxonomy (from above)
type URL ¶
type URL struct { Base string Canonical bool *valueobject.BaseURL }
func (*URL) BasePathNoSlash ¶
func (*URL) MakePath ¶
MakePath takes a string with any characters and replace it so the string could be used in a path. It does so by creating a Unicode-sanitized string, with the spaces replaced, whilst preserving the original casing of the string. E.g. Social Media -> Social-Media
func (*URL) MakePathSanitized ¶
MakePathSanitized creates a Unicode-sanitized string, with the spaces replaced
type WeightedPage ¶ added in v0.0.14
type WeightedPage struct { *Page contenthub.OrdinalWeightPage }
type WeightedPages ¶ added in v0.0.13
type WeightedPages []*WeightedPage
WeightedPages is a list of Pages with their corresponding (and relative) weight [{Weight: 30, Page: *1}, {Weight: 40, Page: *2}]
func (WeightedPages) Count ¶ added in v0.0.14
func (p WeightedPages) Count() int
func (WeightedPages) Len ¶ added in v0.0.14
func (p WeightedPages) Len() int
func (WeightedPages) Less ¶ added in v0.0.14
func (p WeightedPages) Less(i, j int) bool
func (WeightedPages) Page ¶ added in v0.0.13
func (p WeightedPages) Page() *WeightedPage
Page will return the Page (of Kind taxonomyList) that represents this set of pages. This method will panic if p is empty, as that should never happen.
func (WeightedPages) Pages ¶ added in v0.0.14
func (p WeightedPages) Pages() []*WeightedPage
func (WeightedPages) Sort ¶ added in v0.0.14
func (p WeightedPages) Sort()
func (WeightedPages) Swap ¶ added in v0.0.14
func (p WeightedPages) Swap(i, j int)