Skip to content

Commit b176047

Browse files
authored
Merge pull request #2089 from vitali-karmanov/master
Open Graph Tags Incomplete
2 parents d06c1b0 + f43406f commit b176047

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/Piranha.AspNetCore/Extensions/PiranhaHtmlExtensions.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,26 @@ public static HtmlString MetaTags(this IApplicationService app, IMeta content, b
7070
// Generate open graph tags
7171
if (content is PageBase page && page.IsStartPage)
7272
{
73-
sb.AppendLine($"<meta property=\"og:type\" content=\"website\">");
73+
sb.AppendLine($"<meta property=\"og:type\" content=\"website\"/>");
7474
}
7575
else
7676
{
77-
sb.AppendLine($"<meta property=\"og:type\" content=\"article\">");
77+
sb.AppendLine($"<meta property=\"og:type\" content=\"article\"/>");
7878
}
79-
sb.AppendLine($"<meta property=\"og:title\" content=\"{ OgTitle(content) }\">");
79+
sb.AppendLine($"<meta property=\"og:title\" content=\"{ OgTitle(content) }\"/>");
8080
if (content.OgImage != null && content.OgImage.HasValue)
8181
{
82-
sb.AppendLine($"<meta property=\"og:image\" content=\"{ app.AbsoluteContentUrl(content.OgImage) }\">");
82+
sb.AppendLine($"<meta property=\"og:image\" content=\"{ app.AbsoluteContentUrl(content.OgImage) }\"/>");
8383
}
8484
else if (content is RoutedContentBase contentBase && contentBase.PrimaryImage != null && contentBase.PrimaryImage.HasValue)
8585
{
8686
// If there's no OG image specified but we have a primary image,
8787
// default to the primary image.
88-
sb.AppendLine($"<meta property=\"og:image\" content=\"{ app.AbsoluteContentUrl(contentBase.PrimaryImage) }\">");
88+
sb.AppendLine($"<meta property=\"og:image\" content=\"{ app.AbsoluteContentUrl(contentBase.PrimaryImage) }\"/>");
8989
}
9090
if (!string.IsNullOrWhiteSpace(OgDescription(content)))
9191
{
92-
sb.AppendLine($"<meta property=\"og:description\" content=\"{ OgDescription(content) }\">");
92+
sb.AppendLine($"<meta property=\"og:description\" content=\"{ OgDescription(content) }\"/>");
9393
}
9494
}
9595
return new HtmlString(sb.ToString());

0 commit comments

Comments
 (0)