Documentation
¶
Overview ¶
Package render hosts a compiled single-page application and injects per-route Open Graph and Twitter metadata so links unfurl.
The package is HTTP transport. It performs no data access: an application supplies a Resolver for each route, and how that function obtains its facts is invisible here. A link preview is requested by a crawler holding nothing but a URL, so a resolver should return only what any unauthenticated visitor may see.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Dir string
Files fs.FS
Index string
Reserved []string
Defaults Meta
BaseURL string
Routes []Route
ReportResolverError func(context.Context, error)
}
Config declares a renderer. Exactly one of Dir and Files must be set.
type ErrorCode ¶
type ErrorCode string
ErrorCode is the closed set of render failure classifications.
type Link ¶
Link is the request material a metadata resolver may read. Values holds the pattern wildcards resolved by http.ServeMux, so a route registered as "/f/{token}" yields Values["token"]. No header is carried: none is meaningful when the caller is a crawler.
type Meta ¶
type Meta struct {
Title string
Description string
Image string
URL string
Tags map[string]string
Omit []string
}
Meta is the metadata rendered into the shell for one response. The empty string means unset. Tags override the tags generated from the shorthand fields, and Omit deletes generated tags by name.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer serves a bundle and its rendered shell.