question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add dynamic meta images based on page content

See original GitHub issue

ListenNotes.com – founded by a friend of the freeCodeCamp community, Wenbin Fang (@wenbinf) – has dynamic Twitter preview images that show up based on the page contents. We should do something similar with non-/news routes within freeCodeCamp, such as our /learn landing pages, or forum threads.

Here’s an example of what this looks like when linking on Twitter:

_2__Home___Twitter_🔊

The full URL with params: https://www.listennotes.com/search/?q=%22quincy%20larson%22&sort_by_date=1&scope=episode&offset=0&language=Any%20language&len_min=0

I asked Wenbin how he does this, and this was his reply:

It’s a dynamically generated image. There’s an image template, and Python’s pillow library adds text on top of the image template: https://fedingo.com/how-to-add-text-to-image-in-python/

You can change the last word of the url to any texts - https://cdn-images-2.listennotes.com/images/topics/startup/ https://cdn-images-2.listennotes.com/images/topics/something/

You can also use serverless function (eg, aws lambda ) to generate such image and cache the image in s3. This could become a general purpose service to use internally , eg, generating different styled images for different pages on your site. It’s a self contained project, which is ideal for summer intern or new contributor to work on 😃

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
DylanDevelopscommented, Oct 13, 2022

I’m not sure if you are still working on this issue @ahmadabdolsaheb, but I found this. This could be something beneficial! Heres a video explaining some of the stuff with it.

1reaction
DylanDevelopscommented, Aug 19, 2022

I’m totally willing to help with this when you guys are ready. I could help make the templates and also would love to learn exactly how you guys implement this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a dynamic Open Graph (OG) image for your ...
Step 2: Create your dynamic image with PickaPic. Upload the images in sequential order that you want to be displayed. Designate the timeline...
Read more >
Adding dynamic meta tags to a React app without SSR
Optimize your React app (and SEO!) with dynamic meta tags in this detailed tutorial — no server-side rendering required!
Read more >
Dynamically changing the content of: meta property="og:image"
I want to change the main photo in a web page, I just have the url page. So I decided ...
Read more >
How to Dynamically Create Open Graph Images with ...
Open Graph meta tags help make your content more clickable, ... and dynamically pass information based on which page is rendered.
Read more >
How to Dynamically Generate Open Graph Image Variants
Learn how Tuple dynamically generated thousands of Open Graph images (OG images) based on user input using Netlify Edge Functions and Pupeteer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found