This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

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

HomeSlug string
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

canonicalPath UrlPath
baseUrl string
canonicalBaseUrl string

Returns

string

RelativePath

#
public static string RelativePath(UrlPath canonicalPath, string baseUrl)

Root-relative card path for a page, e.g. /social-cards/blog/my-post.png.

Parameters

canonicalPath UrlPath
baseUrl string

Returns

string

SlugToRecordKey

#
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

slug string

Returns

string

Pennington.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)
; }