From f43406f1cd0d9afda66b20381a2218779ce3a02a Mon Sep 17 00:00:00 2001
From: Vitali Karmanov <40288109+vitali-karmanov@users.noreply.github.com>
Date: Sun, 11 Aug 2024 23:06:34 -0600
Subject: [PATCH] Open Graph Tags Incomplete
Some SEO tools, like Ahrefs, are flagging the OG tags as incomplete, which is correct based on https://ogp.me/. We are fixing the issue by adding '/'.
---
.../Extensions/PiranhaHtmlExtensions.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/core/Piranha.AspNetCore/Extensions/PiranhaHtmlExtensions.cs b/core/Piranha.AspNetCore/Extensions/PiranhaHtmlExtensions.cs
index 4ea707b01..a41bc6181 100644
--- a/core/Piranha.AspNetCore/Extensions/PiranhaHtmlExtensions.cs
+++ b/core/Piranha.AspNetCore/Extensions/PiranhaHtmlExtensions.cs
@@ -70,26 +70,26 @@ public static HtmlString MetaTags(this IApplicationService app, IMeta content, b
// Generate open graph tags
if (content is PageBase page && page.IsStartPage)
{
- sb.AppendLine($"");
+ sb.AppendLine($"");
}
else
{
- sb.AppendLine($"");
+ sb.AppendLine($"");
}
- sb.AppendLine($"");
+ sb.AppendLine($"");
if (content.OgImage != null && content.OgImage.HasValue)
{
- sb.AppendLine($"");
+ sb.AppendLine($"");
}
else if (content is RoutedContentBase contentBase && contentBase.PrimaryImage != null && contentBase.PrimaryImage.HasValue)
{
// If there's no OG image specified but we have a primary image,
// default to the primary image.
- sb.AppendLine($"");
+ sb.AppendLine($"");
}
if (!string.IsNullOrWhiteSpace(OgDescription(content)))
{
- sb.AppendLine($"");
+ sb.AppendLine($"");
}
}
return new HtmlString(sb.ToString());