Generate open graph meta tags
This commit is contained in:
@ -15,8 +15,10 @@ struct PageHeader: HtmlProducer {
|
||||
|
||||
init(
|
||||
language: ContentLanguage,
|
||||
title: String,
|
||||
title: String?,
|
||||
description: String?,
|
||||
image: String?,
|
||||
pageUrl: String,
|
||||
iconUrl: String,
|
||||
languageButton: NavigationBar.Link,
|
||||
links: [NavigationBar.Link],
|
||||
@ -29,10 +31,18 @@ struct PageHeader: HtmlProducer {
|
||||
self.icons = icons
|
||||
|
||||
var headers = headers
|
||||
headers.insert(.title(title))
|
||||
if let title {
|
||||
headers.insert(.title(title))
|
||||
headers.insert(.ogTitle(title))
|
||||
}
|
||||
if let description {
|
||||
headers.insert(.description(description))
|
||||
headers.insert(.ogDescription(description))
|
||||
}
|
||||
if let image {
|
||||
headers.insert(.ogImage(image))
|
||||
}
|
||||
headers.insert(.ogUrl(pageUrl))
|
||||
self.headers = headers.sorted()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user