OgImage
type OgImage =
{
Url: string
Alt: string option
Width: int option
Height: int option
}| Assembly | Partas.Nacara.Plugins.OgImage |
The image a page is shared with: what a link preview shows.
Declared inside
FrontMatterImage | What a page's front matter says about its image |
Fields
Url: string
Url: stringAn absolute url, or a path in the output such as /images/card.png.
A path is made absolute with the site's origin, since a crawler reading the tag has no page to resolve it against.
Functions and values
[<Literal>] DataKey: string = "og-image"
[<Literal>] DataKey: string = "og-image"Where the resolved image is stored on a page, as an OgImage option.
None means the page has no image, having opted out or found no fallback.
absoluteUrl (site: SiteInfo) (url: string) : string
absoluteUrl (site: SiteInfo) (url: string) : stringThe absolute url a crawler is given for an image.
A path is taken from the root of the output, under the site's base url. Without an origin there is nothing to make it absolute with, so it stays root-relative.
altKeys (value: string list) (options: OgImageOptions) : OgImageOptions
altKeys (value: string list) (options: OgImageOptions) : OgImageOptionsThe front matter keys the alt text of a plain path is read from.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
apply (site: SiteInfo) (image: OgImage) (html: string) : string
apply (site: SiteInfo) (image: OgImage) (html: string) : stringA rendered page with its image described in the head.
A head that already names an og:image is left alone: the theme chose.
createWith (configure: OgImageOptions -> OgImageOptions) : IPlugin
createWith (configure: OgImageOptions -> OgImageOptions) : IPluginOg-image tags, configured.
| Parameter | |
|---|---|
configure | Given the defaults, the options to use. |
defaultImage (value: OgImage) (options: OgImageOptions) : OgImageOptions
defaultImage (value: OgImage) (options: OgImageOptions) : OgImageOptionsThe image of every page nothing else gave one.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
defaults: OgImageOptionsexcludeCollections (value: string list) (options: OgImageOptions) : OgImageOptions
excludeCollections (value: string list) (options: OgImageOptions) : OgImageOptionsCollections whose pages get no image at all.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
fallback (value: Page -> OgImage option) (options: OgImageOptions) : OgImageOptions
fallback (value: Page -> OgImage option) (options: OgImageOptions) : OgImageOptionsThe image of a page whose front matter names none, asked before the default.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
fromFrontMatter (options: OgImageOptions) (mapping: YamlMappingNode) : FrontMatterImage
fromFrontMatter (options: OgImageOptions) (mapping: YamlMappingNode) : FrontMatterImageRead a page's image out of its front matter.
| Parameter | |
|---|---|
options | Which keys to read. |
mapping | The page's front matter. |
frontMatterKeys (value: string list) (options: OgImageOptions) : OgImageOptions
frontMatterKeys (value: string list) (options: OgImageOptions) : OgImageOptionsThe front matter keys a page names its image under, first match wins.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
image (url: string) : OgImage
image (url: string) : OgImageAn image with nothing but its url.
| Parameter | |
|---|---|
url | An absolute url, or a path in the output. |
localPath (url: string) : string option
localPath (url: string) : string optionThe output path a site-relative image is served from, when it is one.
registerWith (configure: OgImageOptions -> OgImageOptions) (site: Site) : Site
registerWith (configure: OgImageOptions -> OgImageOptions) (site: Site) : SiteAdd og-image tags to a site, configured.
| Parameter | |
|---|---|
configure | Given the defaults, the options to use. |
site | The site being described. |
resolve (options: OgImageOptions) (frontMatter: FrontMatterImage) (page: Page) : OgImage option
resolve (options: OgImageOptions) (frontMatter: FrontMatterImage) (page: Page) : OgImage optionThe image a page ends up with, front matter first and then the fallbacks.
| Parameter | |
|---|---|
options | The fallbacks. |
frontMatter | What the page's front matter said. |
page | The page, handed to Fallback. |
tags (site: SiteInfo) (image: OgImage) (html: string) : string list
tags (site: SiteInfo) (image: OgImage) (html: string) : string listThe head tags for an image, skipping any the head already has.
| Parameter | |
|---|---|
site | For the origin that makes a path absolute. |
image | What to describe. |
html | The rendered page, to see what its head already says. |