コード例 #1
0
 public static ImageObject GetMicrodata(this Image image, IAuthorResolver authorResolver)
 {
     return(new ImageObject
     {
         Author = authorResolver?.GetAuthor() ?? new Organization(),
         Description = image?.Alt ?? String.Empty,
         ContentUrl = new Uri(image?.Src ?? String.Empty, UriKind.RelativeOrAbsolute),
         Url = new Uri(image?.Src ?? String.Empty, UriKind.RelativeOrAbsolute),
         ThumbnailUrl = new Uri(image?.Src ?? String.Empty, UriKind.RelativeOrAbsolute),
         UploadDate = (image?.DateUpdated ?? new DateTime()).ToDateTimeOffset()
     });
 }
コード例 #2
0
        public Thing GetMicrodata(IAuthorResolver authorResolver)
        {
            var splashImageScreen = SplashImageScreen.GetMicrodata(authorResolver);

            return(new VideoObject
            {
                Id = new Uri(@"https://www.youtube.com/watch?v=" + (VideoId ?? string.Empty), UriKind.RelativeOrAbsolute),
                Thumbnail = splashImageScreen,
                ThumbnailUrl = new Uri(SplashImageScreen?.Src ?? string.Empty, UriKind.RelativeOrAbsolute),
                Author = authorResolver?.GetAuthor() ?? new Organization(),
                UploadDate = splashImageScreen.UploadDate,
                Name = SeoVideoName,
                Description = SeoVideoDescription
            });
        }