Documentation ¶
Index ¶
- Variables
- func AddDataSource(ds DataSource)
- func ApplyContentTransforms(data string) string
- func ConfigureShortcodeTemplatePath(cfg *Config)
- func CreateTemplateView(routeRegistry *RouteRegistry, trans i18n.TranslateFunc, ctx *RenderContext, ...) *jet.Set
- func GetCast(f *Film) []string
- func GetCountries(f *Film) []string
- func GetDataSources() map[string]DataSource
- func GetGenres(f *Film) []string
- func GetTVSeasonYear(t *TVSeason) []string
- func GetTVShowCast(t *TVSeason) []string
- func GetTVShowCountries(t *TVSeason) []string
- func GetTVShowGenres(t *TVSeason) []string
- func GetYear(f *Film) []string
- func ReplaceURLArgumentsWithEntityValues(routePrefix string, urlPath string, args []RouteArgument, entity interface{}) string
- func ValidateRouteWithDatasource(urlPath string, ds DataSource) error
- type BonusContent
- type BonusContentCollection
- type Bundle
- type BundleCollection
- type CastMember
- type Collection
- type CollectionCollection
- type Config
- type CrewMember
- type CustomFields
- type DataSource
- type FeatureToggles
- type Film
- type FilmCollection
- type GenericItem
- type GenericItems
- type ImageSet
- type ItemIndex
- func (itemIndex ItemIndex) FindEmptySlugs(slugType string) []string
- func (itemIndex ItemIndex) FindUnresolvedSlugs(slugType string) []string
- func (itemIndex ItemIndex) Get(slug string) (item GenericItem)
- func (itemIndex ItemIndex) MapToUnresolvedItems(items []string) GenericItems
- func (itemIndex ItemIndex) Print()
- func (itemIndex ItemIndex) PrintStats()
- func (itemIndex ItemIndex) Resolve(gItems GenericItems) GenericItems
- func (itemIndex ItemIndex) Set(slug string, item GenericItem)
- type Language
- type LiveReloadConfig
- type Navigation
- type NavigationItem
- type OrderedEntries
- type OrderedEntry
- type Page
- type PageCollection
- type Pages
- type Pagination
- type Plan
- type PlanCollection
- type PrivateConfig
- type RenderContext
- type Renderer
- type Route
- type RouteArgument
- type RouteRegistry
- func (r *RouteRegistry) FindByName(name string) *Route
- func (r *RouteRegistry) FindBySlugAndRouteName(slug string, routeName string) *Route
- func (r *RouteRegistry) FindByTypeAndRouteName(entityType reflect.Type, routeName string) *Route
- func (r *RouteRegistry) GetAll() []*Route
- func (r *RouteRegistry) GetRouteForEntity(ctx RenderContext, entity interface{}, routeName string) string
- func (r *RouteRegistry) GetRouteForSlug(ctx RenderContext, slug string, routeName string) string
- type Runtime
- type Seo
- type ServiceConfig
- func (cfg ServiceConfig) ForceAbsoluteImagePath(url string) string
- func (cfg ServiceConfig) GetInt(key string, defaultArgs ...int) int
- func (cfg ServiceConfig) GetKeywords(keywords string) string
- func (cfg ServiceConfig) GetSEOTitle(seoTitle, title string) string
- func (cfg ServiceConfig) GetSiteName() string
- func (cfg ServiceConfig) SelectDefaultImageType(landscape, portrait string) string
- type Site
- type StringCollection
- type SubtitleTrack
- type TVEpisode
- type TVEpisodeCollection
- type TVSeason
- type TVSeasonCollection
- type TVShow
- type TVShowCollection
- type Taxonomies
- type Taxonomy
- type Trailer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDataSource is returned when no datasource could be found ErrDataSource = "!Error" // ErrDataSourceMissing raises when the datasource could not be found ErrDataSourceMissing = errors.New("Missing") )
var ( // Empty - Generic Item Empty = GenericItem{Slug: "empty"} // Unresolved - a slug to an item that has not been requested Unresolved = GenericItem{Slug: "unresolved"} )
Functions ¶
func ApplyContentTransforms ¶
ApplyContentTransforms - add the markdown / sanitization / shortcodes
func ConfigureShortcodeTemplatePath ¶
func ConfigureShortcodeTemplatePath(cfg *Config)
ConfigureShortcodeTemplatePath sets the directory where the short codes will be loaded from
func CreateTemplateView ¶
func CreateTemplateView(routeRegistry *RouteRegistry, trans i18n.TranslateFunc, ctx *RenderContext, templatePath string) *jet.Set
CreateTemplateView - create a template view
func GetCountries ¶
GetCountries - extract the countries from the film
func GetDataSources ¶
func GetDataSources() map[string]DataSource
GetDataSources returns all registered data sources
func GetTVSeasonYear ¶
GetTVSeasonYear - extract the year from the tv season
func GetTVShowCast ¶
GetTVShowCast - extact the cast members from the tv show
func GetTVShowCountries ¶
GetTVShowCountries - extract the countries from the film
func GetTVShowGenres ¶
GetTVShowGenres - extract the genres from the tv show
func ReplaceURLArgumentsWithEntityValues ¶
func ReplaceURLArgumentsWithEntityValues(routePrefix string, urlPath string, args []RouteArgument, entity interface{}) string
ReplaceURLArgumentsWithEntityValues replaces expected arguments with
func ValidateRouteWithDatasource ¶
func ValidateRouteWithDatasource(urlPath string, ds DataSource) error
ValidateRouteWithDatasource will check the urlPath is valid for a data source
Types ¶
type BonusContent ¶
type BonusContent struct { Slug string Number int Title string Images ImageSet Subtitles []SubtitleTrack Runtime Runtime Overview string CustomFields CustomFields }
BonusContent - bonus content model
func (BonusContent) GetGenericItem ¶
func (bonus BonusContent) GetGenericItem() GenericItem
GetGenericItem - returns a generic item based on the film bonus
type BonusContentCollection ¶
type BonusContentCollection []BonusContent
BonusContentCollection - all bonus content for a film or season
type Bundle ¶
type Bundle struct { ID int Slug string Title string TitleSlug string Tagline string Description string Status string Seo Seo Images ImageSet PromoURL string ExternalID string Items GenericItems PublishedDate time.Time CreatedAt time.Time UpdatedAt time.Time }
Bundle - model
func (Bundle) GetGenericItem ¶
func (bundle Bundle) GetGenericItem() GenericItem
GetGenericItem - returns a generic item
type BundleCollection ¶
type BundleCollection []Bundle
BundleCollection - all bundles
func (BundleCollection) FindBundleByID ¶
func (bundles BundleCollection) FindBundleByID(bundleID int) (*Bundle, error)
FindBundleByID - find the page by id
func (BundleCollection) FindBundleBySlug ¶
func (bundles BundleCollection) FindBundleBySlug(slug string) (*Bundle, error)
FindBundleBySlug - find the bundle by the slug
type Collection ¶
type Collection struct { ID int Slug string Title string TitleSlug string Description string DisplayName string ItemLayout string ItemsPerRow int Images ImageSet Seo Seo Items []GenericItem SearchQuery string CreatedAt string UpdatedAt string }
Collection - collection of films and tv seasons / episodes
func (Collection) GetGenericItem ¶
func (collection Collection) GetGenericItem() GenericItem
GetGenericItem - returns a generic item
type CollectionCollection ¶
type CollectionCollection []Collection
CollectionCollection - all collections
func (CollectionCollection) FindCollectionByID ¶
func (collections CollectionCollection) FindCollectionByID(collectionID int) (*Collection, error)
FindCollectionByID - find the page by id
func (CollectionCollection) FindCollectionBySlug ¶
func (collections CollectionCollection) FindCollectionBySlug(slug string) (*Collection, error)
FindCollectionBySlug - find the collection by the slug
type Config ¶
type Config struct { DefaultLanguage string `json:"defaultLanguage"` Languages map[string]string `json:"languages"` Routes []Route `json:"routes"` SiteURL string `json:"siteUrl"` BuilderVersion string `json:"builderVersion"` Version string `json:"version"` Name string `json:"Name"` Private PrivateConfig `json:"-"` DisableCache bool `json:"-"` RunAsAdmin bool `json:"-"` SkipLogin bool `json:"-"` SiteRootPath string `json:"siteRootPath"` LiveReload LiveReloadConfig `json:"liveReload"` ProxyPatterns []string `json:"proxy"` }
Config - template configuration NOTE: Don't use `SiteRootPath directly`, use `Config.SourcePath()` instead.
func (*Config) FileRootPath ¶
FileRootPath returns the path to be used for copying
func (Config) ShortCodePath ¶
ShortCodePath is the path where the short code templates will be stored
func (Config) SourcePath ¶
SourcePath is an absolute path to where the Site source files are located. Can be configured in `site.json` - `"siteRootPath"`
type CustomFields ¶
type CustomFields map[string]interface{}
CustomFields are key-value pairs that can be aded to a film, season, bonus, or episode
func (CustomFields) GetBool ¶
func (fields CustomFields) GetBool(fieldKey string, defaultValue bool) bool
GetBool returns the custom field in bool format
type DataSource ¶
type DataSource interface { GetName() string GetEntityType() reflect.Type Iterator(ctx RenderContext, renderer Renderer) (errorCount int) IsSlugMatch(slug string) bool GetRouteForEntity(ctx RenderContext, entity interface{}) string GetRouteForSlug(ctx RenderContext, slug string) string GetRouteArguments() []RouteArgument }
DataSource provides a set of data for querying and iterating over
func FindDataSource ¶
func FindDataSource(name string) DataSource
FindDataSource - find the data source by name
type Film ¶
type Film struct { ID int Slug string Title string TitleSlug string Trailers []Trailer Bonuses BonusContentCollection Cast []CastMember Crew []CrewMember Studio []string Overview string Tagline string ReleaseDate time.Time Runtime Runtime Countries StringCollection Languages StringCollection Genres StringCollection Seo Seo Images ImageSet Recommendations []GenericItem Subtitles []SubtitleTrack CustomFields CustomFields }
Film - all of the film bits
func (Film) GetGenericItem ¶
func (film Film) GetGenericItem() GenericItem
GetGenericItem - returns a generic item
type FilmCollection ¶
type FilmCollection []Film
FilmCollection - all films
func (FilmCollection) FindFilmByID ¶
func (films FilmCollection) FindFilmByID(filmID int) (*Film, bool)
FindFilmByID - find film by id
func (FilmCollection) FindFilmBySlug ¶
func (films FilmCollection) FindFilmBySlug(slug string) (*Film, bool)
FindFilmBySlug - find the film by the slug
type GenericItem ¶
type GenericItem struct { // link to the actual item InnerItem interface{} // film / show / season/ episode / bundle / page ItemType string Slug string Title string Images ImageSet Seo Seo }
GenericItem - used to store the common properties
func (*GenericItem) GetTitle ¶
func (i *GenericItem) GetTitle(T i18n.TranslateFunc) string
GetTitle - returns the title in the current language expect to be called as item.GetTitle(i18n) where i18n is the translation function for the current language
func (GenericItem) GetTranslatedTitle ¶
func (i GenericItem) GetTranslatedTitle(T i18n.TranslateFunc, i18nKey string) string
GetTranslatedTitle returns an i18n version of a GenericItem title using the specified key as the template
type GenericItems ¶
type GenericItems []GenericItem
GenericItems - a list of generic items e.g. Films from "2005"
func (GenericItems) Len ¶
func (slice GenericItems) Len() int
func (GenericItems) Less ¶
func (slice GenericItems) Less(i, j int) bool
func (GenericItems) Swap ¶
func (slice GenericItems) Swap(i, j int)
type ImageSet ¶
type ImageSet struct { Background string Carousel string Landscape string Portrait string Header string Classification string Seo string }
ImageSet - set of images
type ItemIndex ¶
type ItemIndex map[string]map[string]GenericItem
ItemIndex - an item index
func (ItemIndex) FindEmptySlugs ¶
FindEmptySlugs - find the slugs that are missing
func (ItemIndex) FindUnresolvedSlugs ¶
FindUnresolvedSlugs - find unresolved slugs
func (ItemIndex) Get ¶
func (itemIndex ItemIndex) Get(slug string) (item GenericItem)
Get - get the slug
func (ItemIndex) MapToUnresolvedItems ¶
func (itemIndex ItemIndex) MapToUnresolvedItems(items []string) GenericItems
MapToUnresolvedItems - create an array of unresolved items from an array of slugs
func (ItemIndex) PrintStats ¶
func (itemIndex ItemIndex) PrintStats()
PrintStats - print the stats about the index
func (ItemIndex) Resolve ¶
func (itemIndex ItemIndex) Resolve(gItems GenericItems) GenericItems
Resolve - convert an array of generic items to resolved items
type LiveReloadConfig ¶
type LiveReloadConfig struct {
IgnoredPaths []string `json:"ignoredPaths"`
}
LiveReloadConfig - configuration options for the live_reloader
type NavigationItem ¶
type NavigationItem struct { int `json:"page_id"` Slug string `json:"slug"` ExternalURL string `json:"url"` } `json:"link"` }PageID
NavigationItem - nestable structure
type OrderedEntry ¶
type OrderedEntry struct { Key string Items GenericItems }
OrderedEntry - a list of items ordered by keys e.g. Key: Horror
type Page ¶
type Page struct { ID int Slug string Title string TitleSlug string Content string Tagline string Seo Seo Images ImageSet PageCollections []PageCollection PageType string URL string }
Page - page structure
func (Page) GetGenericItem ¶
func (page Page) GetGenericItem() GenericItem
GetGenericItem - returns a generic item
type PageCollection ¶
type PageCollection struct { ID int Layout string ItemsPerRow int ItemLayout string Slug string TitleSlug string DisplayName string Items []GenericItem }
PageCollection - part of a page
type Pages ¶
type Pages []Page
Pages -
func (Pages) FindPageByID ¶
FindPageByID - find the page by id
type Pagination ¶
Pagination describes a single page of results
type Plan ¶
type Plan struct { ID int Slug string Name string NameSlug string Description string Interval string IntervalCount int TrialPeriodDays int Page *Page PortraitImage string CreatedAt time.Time UpdatedAt time.Time }
Plan -
type PrivateConfig ¶
type PrivateConfig struct {
APIKey string `json:"apikey"`
}
PrivateConfig - config loaded from
type RenderContext ¶
RenderContext - Context passed during rendering / serving
type Renderer ¶
type Renderer interface { Initialise() Render(templatePath string, filePath string, data jet.VarMap) (errorCount int) }
Renderer - rendering implementation
type Route ¶
type Route struct { Name string `json:"name"` URLPath string `json:"urlPath"` TemplatePath string `json:"templatePath"` PartialURLPath string `json:"partialUrlPath"` PartialTemplatePath string `json:"partialTemplatePath"` DataSource string `json:"datasource"` ResolvedDataSouce DataSource `json:"-"` ResolvedEntityType reflect.Type `json:"-"` PageSize int `json:"pageSize"` Pagination Pagination `json:"-"` }
Route - represents a route for rendering and
func (*Route) HasPartial ¶
HasPartial returns whether the route has partial path (url and template) definitions
type RouteArgument ¶
RouteArgument represents an argument that a route can have
type RouteRegistry ¶
type RouteRegistry struct {
// contains filtered or unexported fields
}
RouteRegistry - stores a list of routes
func NewRouteRegistry ¶
func NewRouteRegistry() *RouteRegistry
NewRouteRegistry - create a new route registry
func NewRouteRegistryFromConfig ¶
func NewRouteRegistryFromConfig(config *Config) *RouteRegistry
NewRouteRegistryFromConfig - create a new route registry from the config
func (*RouteRegistry) FindByName ¶
func (r *RouteRegistry) FindByName(name string) *Route
FindByName - find the route by the name
func (*RouteRegistry) FindBySlugAndRouteName ¶
func (r *RouteRegistry) FindBySlugAndRouteName(slug string, routeName string) *Route
FindBySlugAndRouteName - find a route given a slug and the route name(optional)
func (*RouteRegistry) FindByTypeAndRouteName ¶
func (r *RouteRegistry) FindByTypeAndRouteName(entityType reflect.Type, routeName string) *Route
FindByTypeAndRouteName - find a route given a type of entity and the route name(optional)
func (*RouteRegistry) GetRouteForEntity ¶
func (r *RouteRegistry) GetRouteForEntity(ctx RenderContext, entity interface{}, routeName string) string
GetRouteForEntity - finds the route by the name and type and creates a route from it
func (*RouteRegistry) GetRouteForSlug ¶
func (r *RouteRegistry) GetRouteForSlug(ctx RenderContext, slug string, routeName string) string
GetRouteForSlug - finds the route by the name and type and creates a route from it
type Runtime ¶
type Runtime int
Runtime - Allows us to get accurate measures of hours and minutes.
type Seo ¶
type Seo struct { SiteName string Title string Description string Keywords string Image string VideoURL string }
Seo - common seo settings
type ServiceConfig ¶
ServiceConfig -
func (ServiceConfig) ForceAbsoluteImagePath ¶
func (cfg ServiceConfig) ForceAbsoluteImagePath(url string) string
ForceAbsoluteImagePath fixes up relative image path by prefixing the `image_root_path` to it.
func (ServiceConfig) GetInt ¶
func (cfg ServiceConfig) GetInt(key string, defaultArgs ...int) int
GetInt - get the key and cast
func (ServiceConfig) GetKeywords ¶
func (cfg ServiceConfig) GetKeywords(keywords string) string
GetKeywords - get the keywords, appending any passed keywords
func (ServiceConfig) GetSEOTitle ¶
func (cfg ServiceConfig) GetSEOTitle(seoTitle, title string) string
GetSEOTitle - get the seo title
func (ServiceConfig) GetSiteName ¶
func (cfg ServiceConfig) GetSiteName() string
GetSiteName - get the site name
func (ServiceConfig) SelectDefaultImageType ¶
func (cfg ServiceConfig) SelectDefaultImageType(landscape, portrait string) string
SelectDefaultImageType - select the default image
type Site ¶
type Site struct { Config ServiceConfig SiteConfig *Config Toggles FeatureToggles Languages []Language Pages Pages Films FilmCollection TVShows TVShowCollection TVSeasons TVSeasonCollection TVEpisodes TVEpisodeCollection Bundles BundleCollection Collections CollectionCollection Plans PlanCollection Taxonomies Taxonomies }
Site -
func (Site) PopulateTaxonomyWithFilms ¶
PopulateTaxonomyWithFilms - select the taxonomy and the film attribute
type StringCollection ¶
type StringCollection []string
StringCollection - Allows us to add methods to []string for easing UI array usage
func (StringCollection) Join ¶
func (strings StringCollection) Join(separator string) string
Join - Joins all items in []string using specified separator.
func (StringCollection) String ¶
func (strings StringCollection) String() string
String - overrides String function for []string which joins all items in the array into english readable format.
type SubtitleTrack ¶
SubtitleTrack -
type TVEpisode ¶
type TVEpisode struct { Title string Slug string TitleSlug string EpisodeNumber int Overview string Runtime Runtime Images ImageSet Subtitles []SubtitleTrack CustomFields CustomFields Season *TVSeason }
TVEpisode -
func (TVEpisode) GetGenericItem ¶
func (episode TVEpisode) GetGenericItem() GenericItem
GetGenericItem returns a generic item for the specific episode
func (TVEpisode) GetTitle ¶
func (episode TVEpisode) GetTitle(T i18n.TranslateFunc) string
GetTitle return the localised version of the episode title
func (TVEpisode) GetTranslatedTitle ¶
func (episode TVEpisode) GetTranslatedTitle(T i18n.TranslateFunc, i18nKey string) string
GetTranslatedTitle returns an i18n version of an episode title using the specified key as the template
type TVEpisodeCollection ¶
type TVEpisodeCollection []TVEpisode
TVEpisodeCollection is an array of episodes
func (TVEpisodeCollection) FindTVEpisodeBySlug ¶
func (episodes TVEpisodeCollection) FindTVEpisodeBySlug(slug string) (*TVEpisode, bool)
FindTVEpisodeBySlug returns an episode based on the specified slug
type TVSeason ¶
type TVSeason struct { Slug string SeasonNumber int //TODO: consider removing this Title string Tagline string Overview string PublishingState string ShowInfo *TVShow Seo Seo Images ImageSet Trailers []Trailer Episodes []TVEpisode Bonuses BonusContentCollection Cast []CastMember Crew []CrewMember Recommendations []GenericItem CustomFields CustomFields }
TVSeason -
func (TVSeason) GetGenericItem ¶
func (season TVSeason) GetGenericItem() GenericItem
GetGenericItem - returns a generic item
func (TVSeason) GetTitle ¶
func (season TVSeason) GetTitle(T i18n.TranslateFunc) string
GetTitle return the localised version of the season title
func (TVSeason) GetTranslatedTitle ¶
func (season TVSeason) GetTranslatedTitle(T i18n.TranslateFunc, i18nKey string) string
GetTranslatedTitle returns an i18n version of a season title using the specified key as the template
type TVSeasonCollection ¶
type TVSeasonCollection []TVSeason
TVSeasonCollection -
func (TVSeasonCollection) FindTVSeasonBySlug ¶
func (tvSeasons TVSeasonCollection) FindTVSeasonBySlug(slug string) (*TVSeason, bool)
FindTVSeasonBySlug - find the film by the slug
type TVShow ¶
type TVShow struct { ID int Slug string Trailers []Trailer Genres StringCollection Overview string Countries StringCollection Languages StringCollection ReleaseDate time.Time Tagline string Studio []string Title string TitleSlug string AvailableSeasons []string `json:"-"` Seasons TVSeasonCollection `json:"-"` Images ImageSet }
TVShow -
func (TVShow) GetGenericItem ¶
func (show TVShow) GetGenericItem() GenericItem
GetGenericItem - returns a generic item
type TVShowCollection ¶
type TVShowCollection []TVShow
TVShowCollection -
func (TVShowCollection) FindTVShowByID ¶
func (shows TVShowCollection) FindTVShowByID(showID int) (*TVShow, bool)
FindTVShowByID - find tv show by id
func (TVShowCollection) FindTVShowBySlug ¶
func (shows TVShowCollection) FindTVShowBySlug(slug string) (*TVShow, bool)
FindTVShowBySlug - find the tv show by the slug
type Taxonomy ¶
type Taxonomy map[string]GenericItems
Taxonomy - a grouping of related generic items e.g. films from "2005"
func (Taxonomy) Alphabetical ¶
func (t Taxonomy) Alphabetical() OrderedEntries
Alphabetical - sort the keys