Use favicon if OG image URL is not specified (#52)
This commit is contained in:
@@ -508,9 +508,10 @@ type OpenGraphImage = {
|
||||
|
||||
/// <summary>The <c>meta</c> properties for this image</summary>
|
||||
/// <param name="urlTransform">A function to convert relative URLs to absolute URLs</param>
|
||||
/// <param name="fallbackImage">A relative URL to use for the image if the image property is blank</param>
|
||||
/// <returns>A sequence of key/value pairs for this OpenGraph image file</returns>
|
||||
member this.ToProperties(urlTransform: string -> string) = seq {
|
||||
let url = urlTransform this.Url
|
||||
member this.ToProperties(urlTransform: string -> string, fallbackImage: string option) = seq {
|
||||
let url = urlTransform (if this.Url = "" then defaultArg fallbackImage "" else this.Url)
|
||||
yield "og:image", url
|
||||
if url.StartsWith "https:" then yield "og:image:secure_url", url
|
||||
match this.Type with
|
||||
@@ -691,10 +692,11 @@ type OpenGraphProperties = {
|
||||
|
||||
/// <summary>The <c>meta</c> properties for this page or post</summary>
|
||||
/// <param name="urlTransform">A function to convert relative URLs to absolute URLs</param>
|
||||
/// <param name="fallbackImage">A relative URL to use for the image if the image property is blank</param>
|
||||
/// <returns>A sequence of key/value pairs for this set of OpenGraph properties</returns>
|
||||
member this.ToProperties urlTransform = seq {
|
||||
member this.ToProperties urlTransform fallbackImage = seq {
|
||||
yield "og:type", string this.Type
|
||||
yield! this.Image.ToProperties urlTransform
|
||||
yield! this.Image.ToProperties(urlTransform, fallbackImage)
|
||||
match this.Description with Some desc -> yield "og:description", desc | None -> ()
|
||||
match this.Determiner with Some det -> yield "og:determiner", det | None -> ()
|
||||
match this.Locale with Some loc -> yield "og:locale", loc | None -> ()
|
||||
|
||||
Reference in New Issue
Block a user