From b3cc5ccedde862416f25aa6f3549db2e62bdf7b3 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 10 Sep 2025 21:05:51 +0100 Subject: [PATCH] Enhance metadata handling in MetaTagHelper and views Updated MetaTagHelper.cs to add new metadata properties including ArticlePublishedTime, MetaDescription, and others. Refactored JavaScript in Index1.cshtml for improved readability and added functionality for video playback. Updated metadata attributes in Index.cshtml and Index1.cshtml to support new properties, ensuring better SEO and social media sharing capabilities. --- CatherineLynwood/TagHelpers/MetaTagHelper.cs | 24 +- .../Views/Discovery/Index1.cshtml | 314 +++++++++++------- CatherineLynwood/Views/Home/Index.cshtml | 1 + .../Views/TheAlphaFlame/Index.cshtml | 3 +- 4 files changed, 220 insertions(+), 122 deletions(-) diff --git a/CatherineLynwood/TagHelpers/MetaTagHelper.cs b/CatherineLynwood/TagHelpers/MetaTagHelper.cs index 3f5925d..19c00f1 100644 --- a/CatherineLynwood/TagHelpers/MetaTagHelper.cs +++ b/CatherineLynwood/TagHelpers/MetaTagHelper.cs @@ -8,27 +8,42 @@ namespace CatherineLynwood.TagHelpers #region Public Properties public DateTime? ArticleModifiedTime { get; set; } + public DateTime? ArticlePublishedTime { get; set; } public string MetaAuthor { get; set; } + public string MetaDescription { get; set; } + public string MetaImage { get; set; } + public string MetaImageAlt { get; set; } + + public string MetaImagePNG { get; set; } + public string MetaKeywords { get; set; } + public string MetaTitle { get; set; } + public string MetaUrl { get; set; } public string OgSiteName { get; set; } + public string OgType { get; set; } = "article"; public string TwitterCardType { get; set; } = "summary_large_image"; + public string TwitterCreatorHandle { get; set; } + public int? TwitterPlayerHeight { get; set; } + public int? TwitterPlayerWidth { get; set; } + public string TwitterSiteHandle { get; set; } + public string TwitterVideoUrl { get; set; } - #endregion + #endregion Public Properties #region Public Methods @@ -63,6 +78,9 @@ namespace CatherineLynwood.TagHelpers if (!string.IsNullOrWhiteSpace(MetaImage)) metaTags.AppendLine($""); + if (!string.IsNullOrWhiteSpace(MetaImagePNG)) + metaTags.AppendLine($""); + if (!string.IsNullOrWhiteSpace(MetaImageAlt)) metaTags.AppendLine($""); @@ -124,6 +142,6 @@ namespace CatherineLynwood.TagHelpers output.Content.SetHtmlContent(metaTags.ToString()); } - #endregion + #endregion Public Methods } -} +} \ No newline at end of file diff --git a/CatherineLynwood/Views/Discovery/Index1.cshtml b/CatherineLynwood/Views/Discovery/Index1.cshtml index a5e5b91..40ccc49 100644 --- a/CatherineLynwood/Views/Discovery/Index1.cshtml +++ b/CatherineLynwood/Views/Discovery/Index1.cshtml @@ -399,38 +399,55 @@ + @@ -650,6 +727,7 @@ meta-author="Catherine Lynwood" meta-url="https://www.catherinelynwood.com/the-alpha-flame/discovery" meta-image="https://www.catherinelynwood.com/images/webp/the-alpha-flame-discovery-cover-1200.webp" + meta-image-png="https://www.catherinelynwood.com/images/the-alpha-flame-discovery-cover.png" meta-image-alt="Maggie from 'The Alpha Flame: Discovery' by Catherine Lynwood" og-site-name="Catherine Lynwood - The Alpha Flame: Discovery" article-published-time="@new DateTime(2024, 11, 20)" diff --git a/CatherineLynwood/Views/Home/Index.cshtml b/CatherineLynwood/Views/Home/Index.cshtml index 0f643f4..f6867fd 100644 --- a/CatherineLynwood/Views/Home/Index.cshtml +++ b/CatherineLynwood/Views/Home/Index.cshtml @@ -72,6 +72,7 @@ meta-author="Catherine Lynwood" meta-url="https://www.catherinelynwood.com/" meta-image="https://www.catherinelynwood.com/images/webp/the-alpha-flame-discovery-cover-600.webp" + meta-image-png="https://www.catherinelynwood.com/images/the-alpha-flame-discovery-cover.png" meta-image-alt="Cover artwork from 'The Alpha Flame: Discovery' by Catherine Lynwood" og-site-name="Catherine Lynwood – The Alpha Flame" article-published-time="@new DateTime(2024, 11, 20)" diff --git a/CatherineLynwood/Views/TheAlphaFlame/Index.cshtml b/CatherineLynwood/Views/TheAlphaFlame/Index.cshtml index 4b007be..a76f816 100644 --- a/CatherineLynwood/Views/TheAlphaFlame/Index.cshtml +++ b/CatherineLynwood/Views/TheAlphaFlame/Index.cshtml @@ -162,7 +162,8 @@ meta-keywords="The Alpha Flame trilogy, Catherine Lynwood, 1980s fiction, family saga, twin sisters, Birmingham novel, suspense fiction, indie fiction series" meta-author="Catherine Lynwood" meta-url="https://www.catherinelynwood.com/the-alpha-flame" - meta-image="https://www.catherinelynwood.com/images/webp/the-alpha-flame-trilogy-banner.webp" + meta-image="https://www.catherinelynwood.com/images/webp/the-alpha-flame-discovery-cover-1200.webp" + meta-image-png="https://www.catherinelynwood.com/images/the-alpha-flame-discovery-cover.png" meta-image-alt="The Alpha Flame trilogy banner image showing three covers of the series by Catherine Lynwood" og-site-name="Catherine Lynwood - The Alpha Flame Trilogy" article-published-time="@new DateTime(2024, 11, 20)"