Tsugi

BadgeShareHead
in package

Generates Open Graph and Twitter Card meta tags for badge assertion pages.

Used by Facebook, Twitter, LinkedIn, Bluesky when they crawl the shared URL. Single place for all meta tags - no platform-specific duplication.

Table of Contents

Methods

render()  : string
Render meta tags for social share previews (OG + Twitter Card).
ensureAbsoluteUrl()  : string
Ensure image URL is absolute (required by Twitter, LinkedIn, Bluesky crawlers).

Methods

render()

Render meta tags for social share previews (OG + Twitter Card).

public static render(string $assertUrl, string $badgeTitle, string $courseTitle, string $issuerName, string $imageUrl[, string|null $wwwroot = null ][, string|null $fbAppId = null ]) : string
Parameters
$assertUrl : string

Canonical assertion page URL

$badgeTitle : string

Badge name (e.g. "Origins of Computing")

$courseTitle : string

Course/context title or issuer name

$issuerName : string

Issuer organization name for fallback

$imageUrl : string

Badge image URL (relative or absolute)

$wwwroot : string|null = null

Base URL to make image absolute if needed

$fbAppId : string|null = null

Facebook App ID (optional; silences Facebook's "required" warning)

Return values
string —

HTML fragment of meta tags (newline-separated)

ensureAbsoluteUrl()

Ensure image URL is absolute (required by Twitter, LinkedIn, Bluesky crawlers).

private static ensureAbsoluteUrl(string $url, string $wwwroot) : string
Parameters
$url : string

Image URL (possibly relative)

$wwwroot : string

Base URL (e.g. https://example.com)

Return values
string —

Absolute URL


        
On this page

Search results