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

dynamic og image for pages #61

Open
nagarajpandith opened this issue Sep 30, 2023 · 0 comments
Open

dynamic og image for pages #61

nagarajpandith opened this issue Sep 30, 2023 · 0 comments
Labels
enhancement New feature or request low-priority low priority issue compared to others already present

Comments

@nagarajpandith
Copy link
Member

nagarajpandith commented Sep 30, 2023

  • create a new api route called "og.tsx" at src/pages/api/
  • create a handler which extracts page name from url params and returns an ImageResponse (with the help of @vercel/og package)
  • research on some sleek, minimal OG image templates and use it here
  • it should contain
    • website URL (finiteloop.co.in)
    • our logo (can be found on /public/assets/, compress if needed)
    • our club's name 'Finite Loop Club'
    • page name (extracted from URL params)
    • anything else you'd want to add but keep it minimalistic, not too crowded
  • once API is completed, use it at the right place to pass on page path extracted usePathname hook from 'next/navigation' to the OG API you created. how you will do this is upto your choice, for eg: you can make a shared SEO layout which wraps all incoming pages and attaches the OG info (image, meta desc, page title etc.)
  • motivation: enhance social sharing options

Note
you can refer /src/pages/api/certificate.tsx for an example. we have created an OG image generator there, for digital certificates issued on our website. you can also refer official docs of @vercel/og package to understand more.

@nagarajpandith nagarajpandith added enhancement New feature or request low-priority low priority issue compared to others already present labels Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low-priority low priority issue compared to others already present
Projects
None yet
Development

No branches or pull requests

1 participant