Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add twitter card metadata #459

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
<meta name="og:site_name" content="chatcraft.org" />
<meta property="og:image" content="https://chatcraft.org/favicon-32x32.png" />
<meta property="og:url" content="https://chatcraft.org" />
<meta property="og:type" content="website" />
<meta property="og:title" content="chatcraft.org" />
<meta property="og:description" content="Web-based AI Assistant for Software Developers" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="chatcraft.org" />
<meta name="twitter:description" content="Web-based AI Assistant for Software Developers" />
<meta name="twitter:image" content="https://chatcraft.org/favicon-32x32.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
Expand Down
11 changes: 11 additions & 0 deletions src/lib/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading