All Projects → agneym → generate-og-image

agneym / generate-og-image

Licence: MIT license
Generate open graph images with Github Action from Markdown files

Programming Languages

typescript
32286 projects
Dockerfile
14818 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to generate-og-image

actions
🧰 Collection of github actions for automation
Stars: ✭ 28 (-12.5%)
Mutual labels:  actions, github-actions
pin-github-action
Pin your GitHub actions to a specific hash
Stars: ✭ 38 (+18.75%)
Mutual labels:  actions, github-actions
Real Time Social Media Mining
DevOps pipeline for Real Time Social/Web Mining
Stars: ✭ 22 (-31.25%)
Mutual labels:  actions, github-actions
nextjs-github-pages
🚀 Deploy a Next.js app to Github Pages via Github Actions.
Stars: ✭ 89 (+178.13%)
Mutual labels:  actions, github-actions
verify-changed-files
Github action to verify file changes that occur during the workflow execution.
Stars: ✭ 62 (+93.75%)
Mutual labels:  actions, github-actions
action-netlify-deploy
🙌 Netlify deployments via GitHub actions
Stars: ✭ 32 (+0%)
Mutual labels:  actions, github-actions
branch-names
Github action to retrieve branch or tag names with support for all events.
Stars: ✭ 99 (+209.38%)
Mutual labels:  actions, github-actions
csharp-docs-generator
An action that generates html documentation for C# programs to use for GitHub pages.
Stars: ✭ 21 (-34.37%)
Mutual labels:  actions, github-actions
add-an-issue-reference-action
A GitHub Action for adding a related issue reference to a pull request.
Stars: ✭ 19 (-40.62%)
Mutual labels:  actions, github-actions
k8s-create-secret
GitHub Action to create Kubernetes cluster secrets
Stars: ✭ 24 (-25%)
Mutual labels:  actions, github-actions
dart-package-publisher
Action to Publish Dart / Flutter Package To https://pub.dev When you need to publish a package, just bump the version in pubspec.yaml
Stars: ✭ 45 (+40.63%)
Mutual labels:  actions, github-actions
html5validator-action
GitHub Action that checks HTML5 syntax.
Stars: ✭ 27 (-15.62%)
Mutual labels:  actions, github-actions
deploy-cloudrun
This action deploys your container image to Cloud Run.
Stars: ✭ 238 (+643.75%)
Mutual labels:  actions, github-actions
setup-jdk
(DEPRECATED) Set up your GitHub Actions workflow with a specific version of AdoptOpenJDK
Stars: ✭ 32 (+0%)
Mutual labels:  actions, github-actions
scan-action
Anchore container analysis and scan provided as a GitHub Action
Stars: ✭ 140 (+337.5%)
Mutual labels:  actions, github-actions
mc-publish
GitHub Action that helps you publish your Minecraft mods
Stars: ✭ 76 (+137.5%)
Mutual labels:  actions, github-actions
changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+2190.63%)
Mutual labels:  actions, github-actions
gh-action-get-changed-files
GitHub Action that saves changed files as JSON for use by other actions.
Stars: ✭ 82 (+156.25%)
Mutual labels:  actions, github-actions
clojure-dependency-update-action
A simple GitHub Actions job to create Pull Requests for outdated dependencies in clojure projects
Stars: ✭ 37 (+15.63%)
Mutual labels:  actions, github-actions
danger-action
Execute danger action for GitHub Actions.
Stars: ✭ 24 (-25%)
Mutual labels:  actions, github-actions

Open Graph Image Generator

Generates open graph images for your blog with Github Actions.

This github action scans your PR for changes to md or mdx files, reads frontmatter configuration from them and generates images for your SEO.

If looks very bland without an image when you share the URL, but adding a cover pic with nothing do with your article also does not suit you well. Here is a Github Action based generator that got you covered.

In your action file:

name: "Generate OG Images"
on: pull_request

jobs:
  generate_og_job:
    runs-on: ubuntu-latest
    name: Generate OG Images
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Generate Image
        uses: BoyWithSilverWings/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_CONTEXT: ${{ toJson(github) }}
        with:
          path: src/images/post-images/

For configuring the parameters, add following fields to the frontmatter:

---
ogImage:
  title: "Things you don't know"
  subtitle: "There must be something"
  imageUrl: "https://example.com/image-url.jpg"
  background: "yellow"
  fontColor: "rgb(0, 0, 0)"
  fontSize: "100%"
---

Frontmatter Props

Props Description Required Default
title Title in the image
subtitle Subtitle in the image
imageUrl The image thumbnail on the top
background Background color, gradient or image url
fontColor any css supported color
fontSize the font size
fileName name of the file title prop in kebab case

Works only with Pull Requests and md and mdx files.

Repository level Props

These are props that you can configure in the action file to customise the working.

Props Description Required
path Path to place the image URL in true
commitMsg Commit message when image is added
background Background color, gradient or image url
fontColor any css supported color
fontSize the font size
componentUrl Web Component to be rendered for output.
botComments Whether a comment with a preview image should be posted

Frontmatter level props on a document always takes precedence over Repository level props.

How do I customise the output?

  1. I need a gradient background

    Just as in CSS your frontmatter or Repo level prop can contain:

    background: 'linear-gradient(to right, #ec008c, #fc6767)'
    
  2. What if I need an image as background?

    Write the CSS for it.

    background: 'url(https://example.com/image.png)'
    
  3. What about font sizes?

    you can customise the repository level or frontmatter fontSize props which defaults to 100%. The heading and paragraph font sizes vary depending on it.

    fontSize: 120%;
    
  4. I need an emoji instead of image

    You can pass in the unicode representation of the emoji from the List in imageUrl prop.

  5. I need to format the title

    The title prop supports markdown, feel free to use it.

  6. I don't want these preview image bot comments

    the botComments repo prop should be set to "no"

I need more customisation on the output.

The generator uses a web component to create the default output and provides a repository level prop to customise this web component.

The component currently being used is on Github and published on NPM. The default URL is from Unpkg with https://unpkg.com/@agney/[email protected].

You can substitute the same with componentUrl input in your workflow file. For more info on creating this web component, visit source

Contributing

See docs

Credits

  1. Zeit OG Image

    Serverless based open graph image generator from zeit

  2. Zeit NCC

  3. Github Image Actions

    For some utils to copy from.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].