SocialCardUrl
Pennington.SocialCards
The single card-URL convention shared by the discovery service (SocialCardContentService), the rendering endpoint (MapSocialCards), and the templates' meta-tag wiring, so a page's canonical path and its card URL always agree: {BaseUrl}/{canonical-path}.png, with the home page (empty path) reserved as {BaseUrl}/index.png.
Fields
HomeSlugstring- Default:
"index"Reserved slug for the home page, whose canonical path trims to the empty string.
Methods
For
#public static string For(UrlPath canonicalPath, string baseUrl, string canonicalBaseUrl)
Card URL for a page — absolute when canonicalBaseUrl is set (OpenGraph crawlers require an absolute og:image), otherwise the root-relative path.
Parameters
canonicalPathUrlPathbaseUrlstringcanonicalBaseUrlstring
Returns
stringRelativePath
#public static string RelativePath(UrlPath canonicalPath, string baseUrl)
Root-relative card path for a page, e.g. /social-cards/blog/my-post.png.
Parameters
canonicalPathUrlPathbaseUrlstring
Returns
stringSlugToRecordKey
#public static string SlugToRecordKey(string slug)
Reverses RelativePath: maps the catch-all slug captured after BaseUrl (e.g. blog/my-post.png) back to a ContentRecordRegistry key (blog/my-post); the home slug maps to the empty key.
Parameters
slugstring
Returns
stringPennington.SocialCards.SocialCardUrl
namespace Pennington.SocialCards;
/// The single card-URL convention shared by the discovery service (SocialCardContentService), the rendering endpoint (MapSocialCards), and the templates' meta-tag wiring, so a page's canonical path and its card URL always agree: {BaseUrl}/{canonical-path}.png, with the home page (empty path) reserved as {BaseUrl}/index.png.
public class SocialCardUrl
{
/// Card URL for a page — absolute when canonicalBaseUrl is set (OpenGraph crawlers require an absolute og:image), otherwise the root-relative path.
public static string For(UrlPath canonicalPath, string baseUrl, string canonicalBaseUrl)
;
/// Reserved slug for the home page, whose canonical path trims to the empty string.
public static const string HomeSlug
;
/// Root-relative card path for a page, e.g. /social-cards/blog/my-post.png.
public static string RelativePath(UrlPath canonicalPath, string baseUrl)
;
/// Reverses RelativePath: maps the catch-all slug captured after BaseUrl (e.g. blog/my-post.png) back to a ContentRecordRegistry key (blog/my-post); the home slug maps to the empty key.
public static string SlugToRecordKey(string slug)
;
}