Skip to content

feat: add Open Graph metadata for share links; show Shared Workspace …#202

Merged
urjitc merged 1 commit into
mainfrom
feature/132/share-open-graph
Feb 28, 2026
Merged

feat: add Open Graph metadata for share links; show Shared Workspace …#202
urjitc merged 1 commit into
mainfrom
feature/132/share-open-graph

Conversation

@urjitc

@urjitc urjitc commented Feb 28, 2026

Copy link
Copy Markdown
Member

…in link previews

Made-with: Cursor


Important

Add Open Graph metadata for share links in layout.tsx to enhance link previews for shared workspaces.

  • Metadata Generation:
    • generateMetadata in layout.tsx for /invite/link/[token] and /share-copy/[id] now includes Open Graph and Twitter metadata.
    • Handles cases for not found, expired, and valid links with appropriate titles and descriptions.
  • SEO Enhancements:
    • Uses getPageTitle and getFullImageUrl from seo-config to construct metadata.
    • Constructs URLs using seoConfig.siteUrl for consistency.
  • Misc:
    • Adds InviteLinkLayout and ShareLayout components to wrap children.

This description was created by Ellipsis for 0dee0bc. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • New Features
    • Added dynamic metadata generation for invite links with support for expired link detection.
    • Enhanced shared workspace previews with improved Open Graph and Twitter card metadata for better social media appearance when sharing links.

@vercel

vercel Bot commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
thinkex Building Building Preview, Comment Feb 28, 2026 3:10am

Request Review

@ellipsis-dev ellipsis-dev Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 0dee0bc in 7 seconds. Click for details.
  • Reviewed 172 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_1cv4FerK53moEsAo

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@coderabbitai

coderabbitai Bot commented Feb 28, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Two layout files updated to enhance dynamic metadata generation: a new invite link layout with metadata generation from database queries and conditional handling for expired/invalid links, and an improved share-copy layout with enhanced workspace metadata and localized error handling.

Changes

Cohort / File(s) Summary
Invite Link Layout
src/app/invite/link/[token]/layout.tsx
New layout file with generateMetadata function that queries database for share link data by token, returning appropriate metadata for valid workspaces, expired links, or not-found cases. Includes OpenGraph and Twitter metadata generation.
Share-Copy Layout Enhancement
src/app/share-copy/[id]/layout.tsx
Enhanced generateMetadata with improved not-found handling, seo-config imports, sharedTitle composition, and enriched OpenGraph/Twitter metadata structure including full URLs and image data for both success and error states.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Layout as Layout Component
    participant DB as Database
    participant MetadataService as Metadata Generator
    
    Client->>Layout: Request invite link [token]
    activate Layout
    
    Layout->>DB: Query share link by token
    activate DB
    DB-->>Layout: Share link + workspace data
    deactivate DB
    
    alt Link Not Found
        Layout->>MetadataService: Generate not-found metadata
    else Link Expired
        Layout->>MetadataService: Generate expired metadata
    else Link Valid
        Layout->>MetadataService: Generate workspace metadata
    end
    
    activate MetadataService
    MetadataService-->>Layout: Metadata object with OG/Twitter tags
    deactivate MetadataService
    
    Layout-->>Client: Response with metadata headers
    deactivate Layout
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A clever layout hops with care,
Metadata dancing through the air!
Share links and invites, now they shine,
With workspace names and expiry time!
From database to page we go,
Where OpenGraph tags proudly glow! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add Open Graph metadata for share links; show Shared Workspace' directly summarizes the main change—adding Open Graph metadata to display 'Shared Workspace' in link previews.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/132/share-open-graph

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
src/app/share-copy/[id]/layout.tsx (1)

36-36: Missing images in Twitter metadata for not-found case.

The not-found Twitter metadata omits the images array, whereas the valid workspace case at line 64 includes it. For consistent link preview behavior, consider adding the images here as well.

🔧 Suggested fix
-            twitter: { card: "summary_large_image", title: getPageTitle(notFoundTitle), description: notFoundDesc },
+            twitter: { card: "summary_large_image", title: getPageTitle(notFoundTitle), description: notFoundDesc, images: [getFullImageUrl()] },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/share-copy/`[id]/layout.tsx at line 36, The Twitter metadata for the
not-found branch is missing an images entry; update the metadata object where
twitter: { card: "summary_large_image", title: getPageTitle(notFoundTitle),
description: notFoundDesc } to include an images array (matching the structure
used in the valid workspace metadata) so the not-found preview uses the same
preview image(s); reference getPageTitle, notFoundTitle, and notFoundDesc to
locate the not-found metadata block and mirror the images property from the
workspace metadata branch.
src/app/invite/link/[token]/layout.tsx (2)

26-86: Consider extracting a shared metadata builder helper.

Both this file and src/app/share-copy/[id]/layout.tsx construct nearly identical metadata objects with repeated patterns for OG/Twitter. A helper function like buildShareMetadata({ title, description, url }) could reduce duplication and ensure consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/invite/link/`[token]/layout.tsx around lines 26 - 86, Extract the
repeated metadata construction into a helper (e.g., buildShareMetadata({title,
description, url})) and replace the duplicated openGraph/twitter object assembly
in layout.tsx and src/app/share-copy/[id]/layout.tsx; the helper should accept
title, description, url and internally use getPageTitle, getFullImageUrl and
seoConfig.siteName to build the title, description, openGraph (images with
width/height/alt) and twitter fields so callers (the branches using shareLink,
expired/notFound/shared) simply compute workspaceName/fullTitle/description/url
and return buildShareMetadata({ title: fullTitle, description, url }).

40-40: Missing images in Twitter metadata for not-found and expired cases.

Same issue as in share-copy layout: the Twitter metadata for error states (lines 40 and 58) omits the images array, while the valid case (line 83) includes it.

🔧 Suggested fix for line 40
-            twitter: { card: "summary_large_image", title: getPageTitle(notFoundTitle), description: notFoundDesc },
+            twitter: { card: "summary_large_image", title: getPageTitle(notFoundTitle), description: notFoundDesc, images: [getFullImageUrl()] },
🔧 Suggested fix for line 58
-            twitter: { card: "summary_large_image", title: getPageTitle(expiredTitle), description: expiredDesc },
+            twitter: { card: "summary_large_image", title: getPageTitle(expiredTitle), description: expiredDesc, images: [getFullImageUrl()] },

Also applies to: 58-58

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/invite/link/`[token]/layout.tsx at line 40, The Twitter metadata
objects for the not-found and expired states are missing the images array;
update the twitter metadata in the not-found block (twitter: { card, title:
getPageTitle(notFoundTitle), description: notFoundDesc }) and the expired block
to include an images property that uses the same image URL/source as the valid
invite case (i.e., the twitter.images value used in the successful case),
calling the same image generator/helper you use elsewhere (the Open Graph image
function) so all three cases include identical twitter.images.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/app/invite/link/`[token]/layout.tsx:
- Around line 26-86: Extract the repeated metadata construction into a helper
(e.g., buildShareMetadata({title, description, url})) and replace the duplicated
openGraph/twitter object assembly in layout.tsx and
src/app/share-copy/[id]/layout.tsx; the helper should accept title, description,
url and internally use getPageTitle, getFullImageUrl and seoConfig.siteName to
build the title, description, openGraph (images with width/height/alt) and
twitter fields so callers (the branches using shareLink,
expired/notFound/shared) simply compute workspaceName/fullTitle/description/url
and return buildShareMetadata({ title: fullTitle, description, url }).
- Line 40: The Twitter metadata objects for the not-found and expired states are
missing the images array; update the twitter metadata in the not-found block
(twitter: { card, title: getPageTitle(notFoundTitle), description: notFoundDesc
}) and the expired block to include an images property that uses the same image
URL/source as the valid invite case (i.e., the twitter.images value used in the
successful case), calling the same image generator/helper you use elsewhere (the
Open Graph image function) so all three cases include identical twitter.images.

In `@src/app/share-copy/`[id]/layout.tsx:
- Line 36: The Twitter metadata for the not-found branch is missing an images
entry; update the metadata object where twitter: { card: "summary_large_image",
title: getPageTitle(notFoundTitle), description: notFoundDesc } to include an
images array (matching the structure used in the valid workspace metadata) so
the not-found preview uses the same preview image(s); reference getPageTitle,
notFoundTitle, and notFoundDesc to locate the not-found metadata block and
mirror the images property from the workspace metadata branch.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d28cc62 and 0dee0bc.

📒 Files selected for processing (2)
  • src/app/invite/link/[token]/layout.tsx
  • src/app/share-copy/[id]/layout.tsx

@urjitc
urjitc merged commit 0b19f8e into main Feb 28, 2026
9 checks passed
@urjitc
urjitc deleted the feature/132/share-open-graph branch February 28, 2026 03:14
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Dev Board Feb 28, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant