-
Notifications
You must be signed in to change notification settings - Fork 3
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
created route for OG image responce #84
Open
Rohittomar01
wants to merge
43
commits into
dev
Choose a base branch
from
OG-Image
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
3cf05d7
Install @vercel/og and created route for OG image responce
Rohittomar01 02a3708
in layout page mata data content url changed and lint fixed
Rohittomar01 f4d71f0
content="https://echoes-git-og-image-tcr.vercel.app/api/og"
Rohittomar01 eb3fb00
For check use external image
Rohittomar01 744a5ad
https://www.echoes.team/api/og changed and lint fix
Rohittomar01 b0ab4fb
create metadata in chat page
Rohittomar01 08dd9a4
use metadata tag in layout or page
Rohittomar01 44606fb
used generatemetadata function
Rohittomar01 9ab6523
changed the url of image
Rohittomar01 fb30a73
I tried to generate dynamic title
Rohittomar01 39dd6a2
created image same like mockup
Rohittomar01 320595f
made route public
Rohittomar01 39f6d78
chnaged the layout og image url
Rohittomar01 f5def55
removed this https//www.echoes.team from page and layout.tsx
Rohittomar01 25190d9
tried to make route title dynamically
Rohittomar01 4fa2331
tried to check chat is and chat slug page meta data
Rohittomar01 18a9dee
uncomment data in layout.tsx
Rohittomar01 4980b34
I fetched title with some logic
Rohittomar01 669de3f
commented layout metadata
Rohittomar01 079bafc
uncommented layout metadata
Rohittomar01 e7c25b0
changed something in image metadata
Rohittomar01 ffeeada
changed this publicRoutes: ["/"],
Rohittomar01 d4445b3
again rechanged
Rohittomar01 ee3026b
commentted layout metadata
Rohittomar01 218a02a
uncomment the layout metadata
Rohittomar01 d1db993
gave static title in layout tsx
Rohittomar01 fb30fd6
made public this /dashboard/user
Rohittomar01 6c21f7c
applied org logo
Rohittomar01 e120345
add this line in middleware publicRoutes: ["/api/og", "/*"],
Rohittomar01 8f9e6e8
rechanged publicRoutes: ["/api/og", "/"],
Rohittomar01 a25a021
used tailwind css instead style element
Rohittomar01 5c76334
just for title check
Rohittomar01 dc72067
created robots.txt file
Rohittomar01 22d82c5
changes in robots.txt User-agent: * Allow: /
Rohittomar01 61ceff2
created robots.ts
Rohittomar01 62f4197
changed the allow path in robots allow: "/dashboard/[slug]/chat…
Rohittomar01 64fa141
changed path again allow: "/dashboard/[slug]/chat/[chatid]",
Rohittomar01 c09c76c
chnaged in robost.ts allow:"*", // Allow crawling by any bot
Rohittomar01 935802d
add more url to allow
Rohittomar01 ee9af15
again replace
Rohittomar01 01af17c
lint fixed
Rohittomar01 a512247
added canonical in page.tsx
Rohittomar01 83d5dac
lint fixed
Rohittomar01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { ImageResponse } from "next/og"; | ||
import logo from "@/assets/logo.png"; | ||
// App router includes @vercel/og. | ||
// No need to install it. | ||
|
||
export const runtime = "edge"; | ||
|
||
// Gradient Square Component | ||
function GradientSquare() { | ||
return ( | ||
<div | ||
style={{ | ||
width: "60px", | ||
height: "60px", | ||
background: | ||
"linear-gradient(180deg, rgba(0,128,0,1) 0%, rgba(0,255,0,1) 100%)", | ||
marginBottom: "20px", | ||
}} | ||
></div> | ||
); | ||
} | ||
|
||
function Circle() { | ||
return ( | ||
<div | ||
style={{ | ||
width: "85px", | ||
height: "85px", | ||
backgroundColor: "green", | ||
borderRadius: "50%", | ||
color: "white", | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
marginBottom: "20px", | ||
}} | ||
> | ||
IK | ||
</div> | ||
); | ||
} | ||
|
||
export async function GET(request: Request) { | ||
try { | ||
let title: string | null = ""; | ||
try { | ||
const urlParams = new URLSearchParams(request.url.split("?")[1]); | ||
title = urlParams.get("title"); | ||
console.log("title", title); | ||
} catch (error) { | ||
console.error("Error parsing URL:", error); | ||
} | ||
// const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params | ||
// const title = urlParams.get("title"); | ||
// console.log("title", title); | ||
|
||
// const { searchParams } = new URL(request.url); | ||
// console.log("searchParams", searchParams); | ||
// const hasTitle = searchParams.has("title"); | ||
// const title01 = hasTitle | ||
// ? searchParams.get("title")?.slice(0, 100) | ||
// : "My default title"; | ||
|
||
return new ImageResponse( | ||
( | ||
<div tw="bg-black bg-cover h-screen w-full flex flex-col justify-center p-20"> | ||
<div tw="flex flex-col gap-8"> | ||
<h1 tw="text-white mb-2 text-3xl font-serif font-extrabold w-[42vw]"> | ||
{title | ||
? title | ||
: " The Dual Role of Tween 80 in Biofilm Formation"} | ||
</h1> | ||
<h2 tw="text-gray-500 font-normal font-sans text-2xl"> | ||
Inhibition and Enhancement | ||
</h2> | ||
</div> | ||
<div tw="flex justify-between mt-[100px]"> | ||
<span> | ||
<Circle /> | ||
</span> | ||
<span> | ||
<img | ||
width="85" | ||
height="85" | ||
src={`https://www.echoes.team${logo.src}`} | ||
/> | ||
{/* <GradientSquare /> */} | ||
</span> | ||
</div> | ||
</div> | ||
), | ||
{ | ||
width: 1200, | ||
height: 630, | ||
}, | ||
); | ||
} catch (e: any) { | ||
console.log(`${e.message}`); | ||
return new Response(`Failed to generate the image`, { | ||
status: 500, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MetadataRoute } from "next"; | ||
|
||
export default function robots(): MetadataRoute.Robots { | ||
return { | ||
rules: { | ||
userAgent: "*", | ||
allow: "/", | ||
disallow: "", // No path is disallowed | ||
}, | ||
sitemap: "https://acme.com/sitemap.xml", | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use tailwind and fix the styling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay