From ca5ef709661bfc7415638d1708a1e539d7a858aa Mon Sep 17 00:00:00 2001 From: "Roy J. Wignarajah" <78163326+rjwignar@users.noreply.github.com> Date: Fri, 16 Feb 2024 18:04:43 -0500 Subject: [PATCH] Add twitter card metadata (#459) * added og:type tag * added Twitter meta tags for Twitter Summary Card with Image * updated twitter card type to summary_large_image * added twitter meta tags to shared chat --- index.html | 5 +++++ src/lib/share.ts | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/index.html b/index.html index 608a3209..775dcf32 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,13 @@ + + + + + diff --git a/src/lib/share.ts b/src/lib/share.ts index 5b95fcc9..161c7897 100644 --- a/src/lib/share.ts +++ b/src/lib/share.ts @@ -59,7 +59,18 @@ function generateSharingHTML(chat: ChatCraftChat, user: User) { // Set various types of titles/summaries setMetaContent(clonedDocument, "property", "og:title", chat.summary); setMetaContent(clonedDocument, "property", "og:url", createShareUrl(chat, user)); + setMetaContent(clonedDocument, "property", "og:type", "website"); setMetaContent(clonedDocument, "name", "description", chat.summary); + setMetaContent(clonedDocument, "name", "twitter:card", "summary_large_image"); + setMetaContent(clonedDocument, "name", "twitter:title", "chatcraft.org"); + setMetaContent(clonedDocument, "name", "twitter:description", chat.summary); + setMetaContent( + clonedDocument, + "name", + "twitter:image", + "https://chatcraft.org/favicon-32x32.png" + ); + setDocumentTitle(clonedDocument, chat.summary); // Set OG bulk text to be that of last message if (lastMessageText) {