export function getPostCard(html: HTMLHtmlElement) { const title = html .querySelector('meta[property="cozy:title"]') ?.getAttribute("content") || html.querySelector("title")?.innerHTML?.replace("Cozy 🧸 | ", ""); const description = html .querySelector('meta[property="cozy:description"]') ?.getAttribute("content"); const image = html .querySelector('meta[property="cozy:image"]') ?.getAttribute("content"); const source = html .querySelector('meta[property="cozy:source"]') ?.getAttribute("content"); const published = html .querySelector('meta[property="cozy:published"]') ?.getAttribute("content"); const postCard = `
${ image ? ` ${title} | ${description} ` : '' }
${ source || published ? `
${ source && `

${source}

` } ${ published && `

${ new Date(published)?.toLocaleDateString() || "" }

` }
` : "" }

${title}

${ description ? `

${description}

` : "" }
`; return postCard; }