public static HtmlTag PictureImgTag(PictureAsset pictureDirectoryInfo, string sizes,
                                            bool willHaveVisibleCaption)
        {
            var imageTag = new HtmlTag("img").AddClass("single-photo")
                           .Attr("srcset", pictureDirectoryInfo.SrcSetString())
                           .Attr("src", pictureDirectoryInfo.DisplayPicture.SiteUrl)
                           .Attr("height", pictureDirectoryInfo.DisplayPicture.Height)
                           .Attr("width", pictureDirectoryInfo.DisplayPicture.Width).Attr("loading", "lazy");

            if (!string.IsNullOrWhiteSpace(sizes))
            {
                imageTag.Attr("sizes", sizes);
            }
            else
            {
                imageTag.Attr("sizes", "100vw");
            }

            if (!string.IsNullOrWhiteSpace(pictureDirectoryInfo.DisplayPicture.AltText))
            {
                imageTag.Attr("alt", pictureDirectoryInfo.DisplayPicture.AltText);
            }

            if (!willHaveVisibleCaption && string.IsNullOrWhiteSpace(pictureDirectoryInfo.DisplayPicture.AltText) &&
                !string.IsNullOrWhiteSpace(((ITitleSummarySlugFolder)pictureDirectoryInfo.DbEntry).Summary))
            {
                imageTag.Attr("alt", ((ITitleSummarySlugFolder)pictureDirectoryInfo.DbEntry).Summary);
            }

            return(imageTag);
        }
        public static HtmlTag PictureImgTagWithSmallestDefaultSrc(PictureAsset pictureAsset)
        {
            if (pictureAsset == null)
            {
                return(HtmlTag.Empty());
            }

            var imageTag = new HtmlTag("img").AddClass("thumb-photo").Attr("srcset", pictureAsset.SrcSetString())
                           .Attr("src", pictureAsset.SmallPicture.SiteUrl).Attr("height", pictureAsset.SmallPicture.Height)
                           .Attr("width", pictureAsset.SmallPicture.Width).Attr("loading", "lazy");

            var smallestGreaterThan100 = pictureAsset.SrcsetImages.Where(x => x.Width > 100).OrderBy(x => x.Width)
                                         .FirstOrDefault();

            imageTag.Attr("sizes", smallestGreaterThan100 == null ? "100px" : $"{smallestGreaterThan100.Width}px");

            if (!string.IsNullOrWhiteSpace(pictureAsset.DisplayPicture.AltText))
            {
                imageTag.Attr("alt", pictureAsset.DisplayPicture.AltText);
            }

            return(imageTag);
        }