Code Monkey home page Code Monkey logo

social-image's Introduction

Open graph image service that runs on deta.sh

Deploy

A deta micro that generates a dynamic image that you can embed in your <meta> tag.

Usage

You can simply pass the title and description of your blog post to the micro and it will generate an image for you!

<head>
  <title>Hello World</title>
  <meta
    property="og:image"
    content="https://<micro url>/?title=Hello%20World&description=from%20a%20micro%20running%20on%20deta.sh"
  />
</head>

Why use this service?

From og-image:

The short answer is that it would take a long time to painstakingly design an image for every single blog post and every single documentation page. And we don't want the exact same image for every blog post because that wouldn't make the article stand out when it was shared to Twitter

Deploying to deta.sh

You'll want to fork this repository and deploy your own image generator.

  1. Click the fork button at the top right of this page
  2. Clone the forked repo to your local machine
  3. Customize the html template in public/index.html
  4. Push your changes
  5. Use the Deploy to Deta button to deploy the micro into your project
  6. (Optional) Put your micro behind cloudflare and configure caching

Customizing the image

You can start the demo server to preview how the image will look like

npm run demo

To customize, change the code in public/index.html. Query params in the URL are directly used to replace placeholders in the html file using ETA.

You'll also want to have a fallback image in case something breaks. Replace the file at public/default.png with your own.

Credits

social-image's People

Contributors

harrisjose avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

wdtgbot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.