/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:street_address", this.ContactData.StreetAddress); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:locality", this.ContactData.Locality); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:region", this.ContactData.Region); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:postal_code", this.ContactData.PostalCode); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:country_name", this.ContactData.Country); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:email", this.ContactData.Email); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:phone_number", this.ContactData.Phone); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:fax_number", this.ContactData.Fax); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:website", this.ContactData.Website); if (this.OpeningHours != null) { foreach (var hours in this.OpeningHours) { stringBuilder.AppendMetaPropertyContent("business:hours:day", hours.Day.ToLowercaseString()); stringBuilder.AppendMetaPropertyContent("business:hours:start", hours.Start.ToString(TimeOfDayFormat)); stringBuilder.AppendMetaPropertyContent("business:hours:end", hours.End.ToString(TimeOfDayFormat)); } } stringBuilder.AppendMetaPropertyContent("place:location:latitude", this.Location.Latitude); stringBuilder.AppendMetaPropertyContent("place:location:longitude", this.Location.Longitude); stringBuilder.AppendMetaPropertyContentIfNotNull("place:location:altitude", this.Location.Altitude); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the /// <paramref name="stringBuilder" /> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder"> The string builder. </param> public override void ToString(StringBuilder stringBuilder) { stringBuilder.AppendMetaPropertyContent("og:video", Url); stringBuilder.AppendMetaPropertyContentIfNotNull("og:video:secure_url", UrlSecure); stringBuilder.AppendMetaPropertyContentIfNotNull("og:video:type", Type); stringBuilder.AppendMetaPropertyContentIfNotNull("og:video:width", Width); stringBuilder.AppendMetaPropertyContentIfNotNull("og:video:height", Height); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { stringBuilder.AppendMetaPropertyContent("og:image", this.Url); stringBuilder.AppendMetaPropertyContentIfNotNull("og:image:secure_url", this.UrlSecure); stringBuilder.AppendMetaPropertyContentIfNotNull("og:image:type", this.Type); stringBuilder.AppendMetaPropertyContentIfNotNull("og:image:width", this.Width); stringBuilder.AppendMetaPropertyContentIfNotNull("og:image:height", this.Height); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("books:author", this.AuthorUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:book", this.BookUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:canonical_name", this.CanonicalName); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public virtual void ToString(StringBuilder stringBuilder) { // Three required tags. stringBuilder.AppendMetaPropertyContent("og:title", this.Title); if (this.Type != OpenGraphType.Website) { // The type property is also required but if absent the page will be treated as type website. stringBuilder.AppendMetaPropertyContent("og:type", this.Type.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContent("og:url", this.Url); // Add image, video and audio tags. foreach (OpenGraphMedia media in this.Media) { media.ToString(stringBuilder); } stringBuilder.AppendMetaPropertyContentIfNotNull("og:description", this.Description); stringBuilder.AppendMetaPropertyContentIfNotNull("og:site_name", this.SiteName); if (this.Determiner != OpenGraphDeterminer.Blank) { stringBuilder.AppendMetaPropertyContent("og:determiner", this.Determiner.ToLowercaseString()); } if (this.Locale != null) { stringBuilder.AppendMetaPropertyContent("og:locale", this.Locale); if (this.AlternateLocales != null) { foreach (string locale in this.AlternateLocales) { stringBuilder.AppendMetaPropertyContent("og:locale:alternate", locale); } } } if (this.SeeAlso != null) { foreach (string seeAlso in this.SeeAlso) { stringBuilder.AppendMetaPropertyContent("og:see_also", seeAlso); } } if (this.FacebookAdministrators != null) { foreach (string facebookAdministrator in this.FacebookAdministrators) { stringBuilder.AppendMetaPropertyContentIfNotNull("fb:admins", facebookAdministrator); } } stringBuilder.AppendMetaPropertyContentIfNotNull("fb:app_id", this.FacebookApplicationId); stringBuilder.AppendMetaPropertyContentIfNotNull("fb:profile_id", this.FacebookProfileId); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("book:author", this.AuthorUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("book:isbn", this.Isbn); stringBuilder.AppendMetaPropertyContentIfNotNull("book:release_date", this.ReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("book:tag", this.Tags); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("book:author", this.AuthorUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("book:isbn", this.ISBN); stringBuilder.AppendMetaPropertyContentIfNotNull("book:release_date", this.ReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("book:tag", this.Tags); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:street_address", this.ContactData.StreetAddress); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:locality", this.ContactData.Locality); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:region", this.ContactData.Region); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:postal_code", this.ContactData.PostalCode); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:country_name", this.ContactData.Country); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:email", this.ContactData.Email); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:phone_number", this.ContactData.Phone); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:fax_number", this.ContactData.Fax); stringBuilder.AppendMetaPropertyContentIfNotNull("business:contact_data:website", this.ContactData.Website); if (this.OpeningHours != null) { foreach (OpenGraphHours hours in this.OpeningHours) { stringBuilder.AppendMetaPropertyContent("business:hours:day", hours.Day.ToLowercaseString()); stringBuilder.AppendMetaPropertyContent("business:hours:start", hours.Start.ToString(TimeOfDayFormat)); stringBuilder.AppendMetaPropertyContent("business:hours:end", hours.End.ToString(TimeOfDayFormat)); } } stringBuilder.AppendMetaPropertyContent("place:location:latitude", this.Location.Latitude); stringBuilder.AppendMetaPropertyContent("place:location:longitude", this.Location.Longitude); stringBuilder.AppendMetaPropertyContentIfNotNull("place:location:altitude", this.Location.Altitude); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("music:song", this.SongUrls); // The number of songs on the playlist. This is a Facebook specific property. stringBuilder.AppendMetaPropertyContentIfNotNull("music:song_count", this.SongUrls.Count()); stringBuilder.AppendMetaPropertyContent("music:song:disc", this.SongDisc); stringBuilder.AppendMetaPropertyContent("music:song:track", this.SongTrack); stringBuilder.AppendMetaPropertyContentIfNotNull("music:creator", this.CreatorUrl); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("profile:first_name", this.FirstName); stringBuilder.AppendMetaPropertyContentIfNotNull("profile:last_name", this.LastName); stringBuilder.AppendMetaPropertyContentIfNotNull("profile:username", this.Username); if (this.Gender.HasValue) { stringBuilder.AppendMetaPropertyContent("profile:gender", this.Gender.Value.ToLowercaseString()); } }
public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("article:content_type", ContentType); stringBuilder.AppendMetaPropertyContentIfNotNull("article:published_time", PublishedTime); stringBuilder.AppendMetaPropertyContentIfNotNull("article:modified_time", ModifiedTime); stringBuilder.AppendMetaPropertyContentIfNotNull("article:expiration_time", ExpirationTime); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("books:author", this.AuthorUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:genre", this.GenreUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:initial_release_date", this.InitialReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("books:isbn", this.ISBN); stringBuilder.AppendMetaPropertyContentIfNotNull("books:language", this.Language); stringBuilder.AppendMetaPropertyContentIfNotNull("books:page_count", this.PageCount); if (this.Rating is object) { stringBuilder.AppendMetaPropertyContent("books:rating:value", this.Rating.Value); stringBuilder.AppendMetaPropertyContent("books:rating:scale", this.Rating.Scale); } stringBuilder.AppendMetaPropertyContentIfNotNull("books:release_date", this.ReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("books:sample", this.SampleUrl); }
public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("article:brand", Brand); stringBuilder.AppendMetaPropertyContentIfNotNull("article:category", Category); stringBuilder.AppendMetaPropertyContentIfNotNull("article:price:amount", PriceAmount); stringBuilder.AppendMetaPropertyContentIfNotNull("article:price:currency", PriceCurrency); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("books:book", this.BookUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:genre", this.GenreUrls); if (this.Gender.HasValue) { stringBuilder.AppendMetaPropertyContent("books:gender", this.Gender.Value.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContentIfNotNull("books:official_site", this.OfficialSiteUrl); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("music:song", this.SongUrls); stringBuilder.AppendMetaPropertyContent("music:song:disc", this.SongDisc); stringBuilder.AppendMetaPropertyContent("music:song:track", this.SongTrack); stringBuilder.AppendMetaPropertyContentIfNotNull("music:musician", this.MusicianUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("music:release_date", this.ReleaseDate); if (this.ReleaseType.HasValue) { stringBuilder.AppendMetaPropertyContent("music:release_type", this.ReleaseType.Value.ToLowercaseString()); } }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContent("game:points", this.Points); stringBuilder.AppendMetaPropertyContentIfNotNull("game:secret", this.IsSecret); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("music:duration", this.Duration); stringBuilder.AppendMetaPropertyContentIfNotNull("music:album", this.AlbumUrls); stringBuilder.AppendMetaPropertyContent("music:album:disc", this.AlbumDisc); stringBuilder.AppendMetaPropertyContent("music:album:track", this.AlbumTrack); stringBuilder.AppendMetaPropertyContentIfNotNull("music:musician", this.MusicianUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("music:isrc", this.ISRC); stringBuilder.AppendMetaPropertyContentIfNotNull("music:release_date", this.ReleaseDate); if (this.ReleaseType.HasValue) { stringBuilder.AppendMetaPropertyContent("music:release_type", this.ReleaseType.Value.ToLowercaseString()); } }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContent("place:location:latitude", this.Location.Latitude); stringBuilder.AppendMetaPropertyContent("place:location:longitude", this.Location.Longitude); stringBuilder.AppendMetaPropertyContentIfNotNull("place:location:altitude", this.Location.Altitude); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { if (stringBuilder == null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("profile:first_name", this.FirstName); stringBuilder.AppendMetaPropertyContentIfNotNull("profile:last_name", this.LastName); stringBuilder.AppendMetaPropertyContentIfNotNull("profile:username", this.Username); if (this.Gender.HasValue) { stringBuilder.AppendMetaPropertyContent("profile:gender", this.Gender.Value.ToLowercaseString()); } }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("books:book", this.BookUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:genre", this.GenreUrls); if (this.Gender.HasValue) { stringBuilder.AppendMetaPropertyContent("books:gender", this.Gender.Value.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContentIfNotNull("books:official_site", this.OfficialSiteUrl); }
public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("article:tag", Tags); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContent("game:points", this.Points); stringBuilder.AppendMetaPropertyContentIfNotNull("game:secret", this.IsSecret); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContent("place:location:latitude", this.Location.Latitude); stringBuilder.AppendMetaPropertyContent("place:location:longitude", this.Location.Longitude); stringBuilder.AppendMetaPropertyContentIfNotNull("place:location:altitude", this.Location.Altitude); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("article:author", this.AuthorUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("article:expiration_time", this.ExpirationTime); stringBuilder.AppendMetaPropertyContentIfNotNull("article:modified_time", this.ModifiedTime); stringBuilder.AppendMetaPropertyContentIfNotNull("article:published_time", this.PublishedTime); stringBuilder.AppendMetaPropertyContentIfNotNull("article:publisher", this.PublisherUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("article:section", this.Section); stringBuilder.AppendMetaPropertyContentIfNotNull("article:tag", this.Tags); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); if (this.Actors != null) { foreach (var actor in this.Actors) { stringBuilder.AppendMetaPropertyContentIfNotNull("video:actor", actor.ActorUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("video:actor:role", actor.Role); } } stringBuilder.AppendMetaPropertyContentIfNotNull("video:director", this.DirectorUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("video:writer", this.WriterUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("video:duration", this.Duration); stringBuilder.AppendMetaPropertyContentIfNotNull("video:release_date", this.ReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("video:tag", this.Tags); stringBuilder.AppendMetaPropertyContentIfNotNull("video:series", this.SeriesUrl); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("books:author", this.AuthorUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:genre", this.GenreUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:initial_release_date", this.InitialReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("books:isbn", this.Isbn); stringBuilder.AppendMetaPropertyContentIfNotNull("books:language", this.Language); stringBuilder.AppendMetaPropertyContentIfNotNull("books:page_count", this.PageCount); if (this.Rating != null) { stringBuilder.AppendMetaPropertyContent("books:rating:value", this.Rating.Value); stringBuilder.AppendMetaPropertyContent("books:rating:scale", this.Rating.Scale); } stringBuilder.AppendMetaPropertyContentIfNotNull("books:release_date", this.ReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("books:sample", this.SampleUrl); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContent("place:location:latitude", this.Location.Latitude); stringBuilder.AppendMetaPropertyContent("place:location:longitude", this.Location.Longitude); stringBuilder.AppendMetaPropertyContentIfNotNull("place:location:altitude", this.Location.Altitude); if (this.Categories != null) { foreach (string category in this.Categories) { stringBuilder.AppendMetaPropertyContent("restaurant:category", category); } } if (this.ContactInfo != null) { stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:street_address", this.ContactInfo.StreetAddress); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:locality", this.ContactInfo.Locality); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:region", this.ContactInfo.Region); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:postal_code", this.ContactInfo.PostalCode); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:country_name", this.ContactInfo.Country); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:email", this.ContactInfo.Email); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:phone_number", this.ContactInfo.Phone); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:fax_number", this.ContactInfo.Fax); stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:contact_data:website", this.ContactInfo.Website); } if (this.MenuUrls != null) { foreach (string menuUrl in this.MenuUrls) { stringBuilder.AppendMetaPropertyContent("restaurant:menu", menuUrl); } } stringBuilder.AppendMetaPropertyContentIfNotNull("restaurant:price_rating", this.PriceRating); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); if (this.Actors != null) { foreach (OpenGraphActor actor in this.Actors) { stringBuilder.AppendMetaPropertyContentIfNotNull("video:actor", actor.ActorUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("video:actor:role", actor.Role); } } stringBuilder.AppendMetaPropertyContentIfNotNull("video:director", this.DirectorUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("video:writer", this.WriterUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("video:duration", this.Duration); stringBuilder.AppendMetaPropertyContentIfNotNull("video:release_date", this.ReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("video:tag", this.Tags); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("music:creator", this.CreatorUrl); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); if (this.AgeGroup.HasValue) { stringBuilder.AppendMetaPropertyContent("product:age_group", this.AgeGroup.Value.ToLowercaseString()); } if (this.Availability.HasValue) { stringBuilder.AppendMetaPropertyContent("product:availability", this.Availability.Value.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:brand", this.Brand); stringBuilder.AppendMetaPropertyContentIfNotNull("product:category", this.Category); stringBuilder.AppendMetaPropertyContentIfNotNull("product:color", this.Colour); if (this.Condition.HasValue) { stringBuilder.AppendMetaPropertyContent("product:condition", this.Condition.Value.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:ean", this.EAN); stringBuilder.AppendMetaPropertyContentIfNotNull("product:expiration_time", this.ExpirationTime); stringBuilder.AppendMetaPropertyContentIfNotNull("product:is_product_shareable", this.IsShareable); stringBuilder.AppendMetaPropertyContentIfNotNull("product:isbn", this.ISBN); stringBuilder.AppendMetaPropertyContentIfNotNull("product:material", this.Material); stringBuilder.AppendMetaPropertyContentIfNotNull("product:mfr_part_no", this.ManufacturerPartNumber); if (this.OriginalPrices != null) { foreach (OpenGraphCurrency originalPrice in this.OriginalPrices) { stringBuilder.AppendMetaPropertyContent("product:original_price:amount", originalPrice.Amount); stringBuilder.AppendMetaPropertyContent("product:original_price:currency", originalPrice.Currency); } } stringBuilder.AppendMetaPropertyContentIfNotNull("product:pattern", this.Pattern); stringBuilder.AppendMetaPropertyContentIfNotNull("product:plural_title", this.PluralTitle); if (this.PretaxPrices != null) { foreach (OpenGraphCurrency pretaxPrice in this.PretaxPrices) { stringBuilder.AppendMetaPropertyContent("product:pretax_price:amount", pretaxPrice.Amount); stringBuilder.AppendMetaPropertyContent("product:pretax_price:currency", pretaxPrice.Currency); } } if (this.Prices != null) { foreach (OpenGraphCurrency price in this.Prices) { stringBuilder.AppendMetaPropertyContent("product:price:amount", price.Amount); stringBuilder.AppendMetaPropertyContent("product:price:currency", price.Currency); } } stringBuilder.AppendMetaPropertyContentIfNotNull("product:product_link", this.ProductLinkUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("product:purchase_limit", this.PurchaseLimit); stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer", this.RetailerUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer_category", this.RetailerCategory); stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer_part_no", this.RetailerPartNumber); stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer_title", this.RetailerTitle); if (this.SalePrice != null) { stringBuilder.AppendMetaPropertyContent("product:sale_price:amount", this.SalePrice.Amount); stringBuilder.AppendMetaPropertyContent("product:sale_price:currency", this.SalePrice.Currency); } if (this.SalePriceDates != null) { stringBuilder.AppendMetaPropertyContent("product:sale_price_dates:start", this.SalePriceDates.Start); stringBuilder.AppendMetaPropertyContent("product:sale_price_dates:end", this.SalePriceDates.End); } if (this.ShippingCost != null) { foreach (OpenGraphCurrency shippingCost in this.ShippingCost) { stringBuilder.AppendMetaPropertyContent("product:shipping_cost:amount", shippingCost.Amount); stringBuilder.AppendMetaPropertyContent("product:shipping_cost:currency", shippingCost.Currency); } } if (this.ShippingWeight != null) { stringBuilder.AppendMetaPropertyContent("product:shipping_weight:value", this.ShippingWeight.Value); stringBuilder.AppendMetaPropertyContent("product:shipping_weight:units", this.ShippingWeight.Units); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:size", this.Size); if (this.TargetGender.HasValue) { stringBuilder.AppendMetaPropertyContent("product:target_gender", this.TargetGender.Value.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:upc", this.UPC); if (this.Weight != null) { stringBuilder.AppendMetaPropertyContent("product:weight:value", this.Weight.Value); stringBuilder.AppendMetaPropertyContent("product:weight:units", this.Weight.Units); } }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public virtual void ToString(StringBuilder stringBuilder) { // Three required tags. stringBuilder.AppendMetaPropertyContent("og:title", this.Title); if (this.Type != OpenGraphType.Website) { // The type property is also required but if absent the page will be treated as type website. stringBuilder.AppendMetaPropertyContent("og:type", this.Type.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContent("og:url", this.Url); // Add image, video and audio tags. foreach (OpenGraphMedia media in this.media) { media.ToString(stringBuilder); } stringBuilder.AppendMetaPropertyContentIfNotNull("og:description", this.Description); stringBuilder.AppendMetaPropertyContentIfNotNull("og:site_name", this.SiteName); if (this.Determiner != OpenGraphDeterminer.Blank) { stringBuilder.AppendMetaPropertyContent("og:determiner", this.Determiner.ToLowercaseString()); } if (this.Locale != null) { stringBuilder.AppendMetaPropertyContent("og:locale", this.Locale); if (this.AlternateLocales != null) { foreach (string locale in this.AlternateLocales) { stringBuilder.AppendMetaPropertyContent("og:locale:alternate", locale); } } } if (this.SeeAlso != null) { foreach (string seeAlso in this.SeeAlso) { stringBuilder.AppendMetaPropertyContent("og:see_also", seeAlso); } } if (this.FacebookAdministrators != null) { foreach (string facebookAdministrator in this.FacebookAdministrators) { stringBuilder.AppendMetaPropertyContentIfNotNull("fb:admins", facebookAdministrator); } } stringBuilder.AppendMetaPropertyContentIfNotNull("fb:app_id", this.FacebookApplicationId); stringBuilder.AppendMetaPropertyContentIfNotNull("fb:profile_id", this.FacebookProfileId); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContentIfNotNull("books:author", this.AuthorUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:genre", this.GenreUrls); stringBuilder.AppendMetaPropertyContentIfNotNull("books:initial_release_date", this.InitialReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("books:isbn", this.ISBN); stringBuilder.AppendMetaPropertyContentIfNotNull("books:language", this.Language); stringBuilder.AppendMetaPropertyContentIfNotNull("books:page_count", this.PageCount); if (this.Rating != null) { stringBuilder.AppendMetaPropertyContent("books:rating:value", this.Rating.Value); stringBuilder.AppendMetaPropertyContent("books:rating:scale", this.Rating.Scale); } stringBuilder.AppendMetaPropertyContentIfNotNull("books:release_date", this.ReleaseDate); stringBuilder.AppendMetaPropertyContentIfNotNull("books:sample", this.SampleUrl); }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); if (this.AgeGroup.HasValue) { stringBuilder.AppendMetaPropertyContent("product:age_group", this.AgeGroup.Value.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContent("product:availability", this.Availability.ToLowercaseString()); stringBuilder.AppendMetaPropertyContentIfNotNull("product:brand", this.Brand); stringBuilder.AppendMetaPropertyContentIfNotNull("product:category", this.Category); stringBuilder.AppendMetaPropertyContentIfNotNull("product:color", this.Colour); stringBuilder.AppendMetaPropertyContent("product:condition", this.Condition.ToLowercaseString()); stringBuilder.AppendMetaPropertyContentIfNotNull("product:expiration_time", this.ExpirationTime); stringBuilder.AppendMetaPropertyContentIfNotNull("product:group_ref", this.GroupUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("product:gtin", this.GTIN); stringBuilder.AppendMetaPropertyContentIfNotNull("product:mfr_part_no", this.ManufacturerPartNumber); stringBuilder.AppendMetaPropertyContentIfNotNull("product:material", this.Material); stringBuilder.AppendMetaPropertyContentIfNotNull("product:pattern", this.Pattern); foreach (OpenGraphCurrency price in this.Prices) { stringBuilder.AppendMetaPropertyContent("product:price:amount", price.Amount); stringBuilder.AppendMetaPropertyContent("product:price:currency", price.Currency); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer_category", this.RetailerCategory); stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer_group_id", this.RetailerGroupId); stringBuilder.AppendMetaPropertyContent("product:retailer_item_id", this.RetailerItemId); if (this.SalePrice != null) { stringBuilder.AppendMetaPropertyContent("product:sale_price:amount", this.SalePrice.Amount); stringBuilder.AppendMetaPropertyContent("product:sale_price:currency", this.SalePrice.Currency); } if (this.SalePriceDates != null) { stringBuilder.AppendMetaPropertyContent("product:sale_price_dates:start", this.SalePriceDates.Start); stringBuilder.AppendMetaPropertyContent("product:sale_price_dates:end", this.SalePriceDates.End); } if (this.ShippingCost != null) { foreach (OpenGraphCurrency shippingCost in this.ShippingCost) { stringBuilder.AppendMetaPropertyContent("product:shipping_cost:amount", shippingCost.Amount); stringBuilder.AppendMetaPropertyContent("product:shipping_cost:currency", shippingCost.Currency); } } if (this.ShippingWeight != null) { stringBuilder.AppendMetaPropertyContent("product:shipping_weight:value", this.ShippingWeight.Value); stringBuilder.AppendMetaPropertyContent("product:shipping_weight:units", this.ShippingWeight.Units); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:size", this.Size); if (this.TargetGender.HasValue) { stringBuilder.AppendMetaPropertyContent("product:target_gender", this.TargetGender.Value.ToLowercaseString()); } }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } base.ToString(stringBuilder); if (this.AgeGroup.HasValue) { stringBuilder.AppendMetaPropertyContent("product:age_group", this.AgeGroup.Value.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContent("product:availability", this.Availability.ToLowercaseString()); stringBuilder.AppendMetaPropertyContentIfNotNull("product:brand", this.Brand); stringBuilder.AppendMetaPropertyContentIfNotNull("product:category", this.Category); stringBuilder.AppendMetaPropertyContentIfNotNull("product:color", this.Colour); stringBuilder.AppendMetaPropertyContent("product:condition", this.Condition.ToLowercaseString()); stringBuilder.AppendMetaPropertyContentIfNotNull("product:expiration_time", this.ExpirationTime); stringBuilder.AppendMetaPropertyContentIfNotNull("product:group_ref", this.GroupUrl); stringBuilder.AppendMetaPropertyContentIfNotNull("product:gtin", this.GTIN); stringBuilder.AppendMetaPropertyContentIfNotNull("product:mfr_part_no", this.ManufacturerPartNumber); stringBuilder.AppendMetaPropertyContentIfNotNull("product:material", this.Material); stringBuilder.AppendMetaPropertyContentIfNotNull("product:pattern", this.Pattern); foreach (var price in this.Prices) { stringBuilder.AppendMetaPropertyContent("product:price:amount", price.Amount); stringBuilder.AppendMetaPropertyContent("product:price:currency", price.Currency); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer_category", this.RetailerCategory); stringBuilder.AppendMetaPropertyContentIfNotNull("product:retailer_group_id", this.RetailerGroupId); stringBuilder.AppendMetaPropertyContent("product:retailer_item_id", this.RetailerItemId); if (this.SalePrice != null) { stringBuilder.AppendMetaPropertyContent("product:sale_price:amount", this.SalePrice.Amount); stringBuilder.AppendMetaPropertyContent("product:sale_price:currency", this.SalePrice.Currency); } if (this.SalePriceDates != null) { stringBuilder.AppendMetaPropertyContent("product:sale_price_dates:start", this.SalePriceDates.Start); stringBuilder.AppendMetaPropertyContent("product:sale_price_dates:end", this.SalePriceDates.End); } if (this.ShippingCost != null) { foreach (var shippingCost in this.ShippingCost) { stringBuilder.AppendMetaPropertyContent("product:shipping_cost:amount", shippingCost.Amount); stringBuilder.AppendMetaPropertyContent("product:shipping_cost:currency", shippingCost.Currency); } } if (this.ShippingWeight != null) { stringBuilder.AppendMetaPropertyContent("product:shipping_weight:value", this.ShippingWeight.Value); stringBuilder.AppendMetaPropertyContent("product:shipping_weight:units", this.ShippingWeight.Units); } stringBuilder.AppendMetaPropertyContentIfNotNull("product:size", this.Size); if (this.TargetGender.HasValue) { stringBuilder.AppendMetaPropertyContent("product:target_gender", this.TargetGender.Value.ToLowercaseString()); } }
/// <summary> /// Appends a HTML-encoded string representing this instance to the <paramref name="stringBuilder"/> containing the Open Graph meta tags. /// </summary> /// <param name="stringBuilder">The string builder.</param> public override void ToString(StringBuilder stringBuilder) { base.ToString(stringBuilder); stringBuilder.AppendMetaPropertyContent("fitness:calories", this.Calories); if (this.CustomUnitEnergy != null) { stringBuilder.AppendMetaPropertyContent("fitness:custom_unit_energy:value", this.CustomUnitEnergy.Value); stringBuilder.AppendMetaPropertyContent("fitness:custom_unit_energy:units", this.CustomUnitEnergy.Units); } if (this.Distance != null) { stringBuilder.AppendMetaPropertyContent("fitness:distance:value", this.Distance.Value); stringBuilder.AppendMetaPropertyContent("fitness:distance:units", this.Distance.Units); } if (this.Duration != null) { stringBuilder.AppendMetaPropertyContent("fitness:duration:value", this.Duration.Value); stringBuilder.AppendMetaPropertyContent("fitness:duration:units", this.Duration.Units); } stringBuilder.AppendMetaPropertyContentIfNotNull("fitness:live_text", this.LiveText); if (this.Metrics != null) { foreach (var metric in this.Metrics) { stringBuilder.AppendMetaPropertyContentIfNotNull("fitness:metrics:calories", metric.Calories); if (metric.CustomUnitEnergy != null) { stringBuilder.AppendMetaPropertyContent("fitness:metrics:custom_unit_energy:value", metric.CustomUnitEnergy.Value); stringBuilder.AppendMetaPropertyContent("fitness:metrics:custom_unit_energy:units", metric.CustomUnitEnergy.Units); } if (metric.Distance != null) { stringBuilder.AppendMetaPropertyContent("fitness:metrics:distance:value", metric.Distance.Value); stringBuilder.AppendMetaPropertyContent("fitness:metrics:distance:units", metric.Distance.Units); } if (metric.Location != null) { stringBuilder.AppendMetaPropertyContent("fitness:metrics:location:latitude", metric.Location.Latitude); stringBuilder.AppendMetaPropertyContent("fitness:metrics:location:longitude", metric.Location.Longitude); stringBuilder.AppendMetaPropertyContentIfNotNull("fitness:metrics:location:altitude", metric.Location.Altitude); } stringBuilder.AppendMetaPropertyContentIfNotNull("fitness:metrics:steps", metric.Steps); if (metric.Speed != null) { stringBuilder.AppendMetaPropertyContent("fitness:metrics:speed:value", metric.Speed.Value); stringBuilder.AppendMetaPropertyContent("fitness:metrics:speed:units", metric.Speed.Units); } stringBuilder.AppendMetaPropertyContentIfNotNull("fitness:metrics:timestamp", metric.Timestamp); if (metric.Pace != null) { stringBuilder.AppendMetaPropertyContent("fitness:metrics:pace:value", metric.Pace.Value); stringBuilder.AppendMetaPropertyContent("fitness:metrics:pace:units", metric.Pace.Units); } } } if (this.Pace != null) { stringBuilder.AppendMetaPropertyContent("fitness:pace:value", this.Pace.Value); stringBuilder.AppendMetaPropertyContent("fitness:pace:units", this.Pace.Units); } if (this.Speed != null) { stringBuilder.AppendMetaPropertyContent("fitness:speed:value", this.Speed.Value); stringBuilder.AppendMetaPropertyContent("fitness:speed:units", this.Speed.Units); } if (this.Splits != null) { foreach (var split in this.Splits) { stringBuilder.AppendMetaPropertyContent("fitness:splits:unit", split.IsMiles ? "mi" : "km"); foreach (var value in split.Values) { stringBuilder.AppendMetaPropertyContent("fitness:splits:values:value", value.Value); stringBuilder.AppendMetaPropertyContent("fitness:splits:values:units", value.Units); } } } }
public override void ToString(StringBuilder stringBuilder) { if (stringBuilder is null) { throw new ArgumentNullException(nameof(stringBuilder)); } stringBuilder.AppendMetaPropertyContent("og:title", Title); if (Type != OpenGraphType.Website) { stringBuilder.AppendMetaPropertyContent("og:type", Type.ToLowercaseString()); } stringBuilder.AppendMetaPropertyContent("og:url", Url); foreach (OpenGraphMedia medium in Media) { stringBuilder.AppendMetaPropertyContent("og:image", medium.Url); } stringBuilder.AppendMetaPropertyContentIfNotNull("og:description", Description); stringBuilder.AppendMetaPropertyContentIfNotNull("og:site_name", SiteName); if (Determiner != 0) { stringBuilder.AppendMetaPropertyContent("og:determiner", Determiner.ToLowercaseString()); } if (Locale != null) { stringBuilder.AppendMetaPropertyContent("og:locale", Locale); if (AlternateLocales != null) { foreach (string alternateLocale in AlternateLocales) { stringBuilder.AppendMetaPropertyContent("og:locale:alternate", alternateLocale); } } } if (SeeAlso != null) { foreach (string item in SeeAlso) { stringBuilder.AppendMetaPropertyContent("og:see_also", item); } } if (FacebookAdministrators != null) { foreach (string facebookAdministrator in FacebookAdministrators) { stringBuilder.AppendMetaPropertyContentIfNotNull("fb:admins", facebookAdministrator); } } stringBuilder.AppendMetaPropertyContentIfNotNull("fb:app_id", FacebookApplicationId); stringBuilder.AppendMetaPropertyContentIfNotNull("fb:profile_id", FacebookProfileId); stringBuilder.AppendMetaPropertyContentIfNotNull("article:content_type", ContentType); stringBuilder.AppendMetaPropertyContentIfNotNull("article:category", Category); stringBuilder.AppendMetaPropertyContentIfNotNull("article:industry", Industry); stringBuilder.AppendMetaPropertyContentIfNotNull("article:published_time", PublishedTime); stringBuilder.AppendMetaPropertyContentIfNotNull("article:modified_time", ModifiedTime); stringBuilder.AppendMetaPropertyContentIfNotNull("article:expiration_time", ExpirationTime); }