Documentation ¶
Index ¶
- func AssetUrl(path string) string
- func DecorateContext(c context.Context, k ContextKey, v string) context.Context
- func GetCanonicalUrl(c context.Context) string
- func GetDescription(c context.Context) string
- func GetEnvironment(c context.Context) string
- func GetOpenGraphTags(c context.Context) map[string]string
- func GetTitle(c context.Context) string
- func GetTwitterTags(c context.Context) map[string]string
- func StripHtmlTags(s string) string
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecorateContext ¶
DecorateContext decorates the given context with a key-value pair. It returns a new context with the provided key-value pair added.
func GetCanonicalUrl ¶ added in v0.12.0
GetCanonicalUrl returns the canonical URL from the given context. If the canonical URL is found in the context, it is returned. Otherwise, an empty string is returned.
func GetDescription ¶
GetDescription retrieves the description value from the context. If the value is found and is of type string, it is returned. Otherwise, an empty string is returned.
func GetEnvironment ¶
GetEnvironment returns the environment value from the given context. If the environment value is not found in the context, it returns "dev" as the default value.
func GetTitle ¶
GetTitle retrieves the title from the context. If the title is found, it returns the title as a string. If the title is not found, it returns an empty string.
func StripHtmlTags ¶ added in v0.12.0
Types ¶
type ContextKey ¶
type ContextKey string
var CanonicalUrlKey ContextKey = "canonical:url"
var DescriptionKey ContextKey = "description"
var EnvironmentKey ContextKey = "environment"
var OgDescriptionKey ContextKey = "og:description"
var OgImageKey ContextKey = "og:image"
var OgSiteNameKey ContextKey = "og:site_name"
var OgTitleKey ContextKey = "og:title"
var OgTypeKey ContextKey = "og:type"
var OgUrlKey ContextKey = "og:url"
var TitleKey ContextKey = "title"
var TwitterCardKey ContextKey = "twitter:card"
var TwitterCreatorKey ContextKey = "twitter:creator"
var TwitterDescriptionKey ContextKey = "twitter:description"
var TwitterImageKey ContextKey = "twitter:image"
var TwitterSiteKey ContextKey = "twitter:site"
var TwitterTitleKey ContextKey = "twitter:title"