Documentation ¶
Index ¶
- Variables
- func DecorableFrom(ctx context.Context) bool
- func Host(r *http.Request) string
- func Languages(r *http.Request) []string
- func MatchRequest(site cms.Site, r *http.Request) (string, error)
- func NotDecorableFrom(ctx context.Context) bool
- func PageFrom(ctx context.Context) (cms.Page, bool)
- func PreferredLanguage(locales []string, r *http.Request) string
- func PreferredSite(sites []cms.Site, r *http.Request) cms.Site
- func Scheme(r *http.Request) string
- func SetDecoratorHeaders(ctx context.Context, w http.ResponseWriter)
- func SiteFrom(ctx context.Context) (cms.Site, bool)
- func WithDecorable(ctx context.Context, decorable bool) context.Context
- func WithNotDecorable(ctx context.Context, notDecorable bool) context.Context
- func WithPage(ctx context.Context, page cms.Page) context.Context
- func WithPageSEO(ctx context.Context, page cms.Page) context.Context
- func WithSEO(ctx context.Context, seo PageSEO) context.Context
- func WithSite(ctx context.Context, site cms.Site) context.Context
- func WithSiteSEO(ctx context.Context, site cms.Site) context.Context
- type DecoratorStrategy
- type HostByLocaleSiteSelector
- type HostPathByLocaleSiteSelector
- type HostPathSiteSelector
- type HostSiteSelector
- type Ignore
- type PageRouter
- type PageSEO
- type SelectorType
- type SiteSelector
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPageNotCMS = errors.New("page is not cms") ErrPageRequestMethod = errors.New("page request method is not allowed") )
View Source
var ErrSiteNotFound = errors.New("site not found")
View Source
var Selectors = []SelectorType{ HostSelector, HostByLocaleSelector, HostPathSelector, HostPathByLocaleSelector, }
Functions ¶
func DecorableFrom ¶
func NotDecorableFrom ¶
func SetDecoratorHeaders ¶
func SetDecoratorHeaders(ctx context.Context, w http.ResponseWriter)
func WithNotDecorable ¶
Types ¶
type DecoratorStrategy ¶
type DecoratorStrategy interface { IsDecorable(r *http.Request, routeName string) bool IsRouteNameDecorable(ctx context.Context, routeName string) bool IsRouteURIDecorable(ctx context.Context, uri string) bool }
func NewDecoratorStrategy ¶
func NewDecoratorStrategy(ignore Ignore) DecoratorStrategy
type HostByLocaleSiteSelector ¶
type HostByLocaleSiteSelector struct {
// contains filtered or unexported fields
}
func NewHostByLocaleSiteSelector ¶
func NewHostByLocaleSiteSelector(siteService cms.SiteService) HostByLocaleSiteSelector
func (HostByLocaleSiteSelector) Type ¶
func (s HostByLocaleSiteSelector) Type() SelectorType
type HostPathByLocaleSiteSelector ¶
type HostPathByLocaleSiteSelector struct {
// contains filtered or unexported fields
}
func NewHostPathByLocaleSiteSelector ¶
func NewHostPathByLocaleSiteSelector(siteService cms.SiteService) HostPathByLocaleSiteSelector
func (HostPathByLocaleSiteSelector) Type ¶
func (s HostPathByLocaleSiteSelector) Type() SelectorType
type HostPathSiteSelector ¶
type HostPathSiteSelector struct {
// contains filtered or unexported fields
}
func NewHostPathSiteSelector ¶
func NewHostPathSiteSelector(siteService cms.SiteService) HostPathSiteSelector
func (HostPathSiteSelector) Type ¶
func (s HostPathSiteSelector) Type() SelectorType
type HostSiteSelector ¶
type HostSiteSelector struct {
// contains filtered or unexported fields
}
func NewHostSiteSelector ¶
func NewHostSiteSelector(siteService cms.SiteService) HostSiteSelector
func (HostSiteSelector) Type ¶
func (s HostSiteSelector) Type() SelectorType
type PageRouter ¶
type PageRouter interface {
Match(ctx context.Context, site cms.Site, method string, path string) (cms.Page, error)
}
func NewPageRouter ¶
func NewPageRouter(service cms.PageService) PageRouter
type PageSEO ¶
type PageSEO interface { AddFromSite(site cms.Site) PageSEO AddFromPage(page cms.Page) PageSEO Title() string SetTitle(title string) PageSEO AddTitlePrefix(prefix string) PageSEO AddTitleSuffix(suffix string) PageSEO OriginalTitle() string SetSeparator(separator string) PageSEO Metas() map[string]map[string]string SetMetas(metas map[string]map[string]string) PageSEO AddMeta(typ, name, content string) PageSEO RemoveMeta(typ, name string) PageSEO HasMeta(typ, name string) bool HTMLAttributes() map[string]string SetHTMLAttributes(attrs map[string]string) PageSEO AddHTMLAttribute(name, content string) PageSEO RemoveHTMLAttribute(name string) PageSEO HasHTMLAttribute(name string) bool HeadAttributes() map[string]string SetHeadAttributes(attrs map[string]string) PageSEO AddHeadAttribute(name, content string) PageSEO RemoveHeadAttribute(name string) PageSEO HasHeadAttribute(name string) bool LinkCanonical() string SetLinkCanonical(link string) PageSEO RemoveLinkCanonical() PageSEO LangAlternates() map[string]string SetLangAlternates(langAlternates map[string]string) PageSEO AddLangAlternate(href, hreflang string) PageSEO RemoveLangAlternate(href string) PageSEO HasLangAlternate(href string) bool OEmbedLinks() map[string]string AddOEmbedLink(title, link string) PageSEO }
func NewPageSEO ¶
func NewPageSEO() PageSEO
type SelectorType ¶
type SelectorType string
const ( HostSelector SelectorType = "host" HostByLocaleSelector SelectorType = "host_by_locale" HostPathSelector SelectorType = "host_with_path" HostPathByLocaleSelector SelectorType = "host_with_path_by_locale" )
func (SelectorType) String ¶
func (t SelectorType) String() string
type SiteSelector ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.