Skip to content

FabulousCupcake/gbf-wiki-opengraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gbf-wiki-opengraph

Synchronize Synchronize

This repository enables gbf.wiki to use fancy opengraph images on weapon, character (tba), and summon pages. The images are tailored/optimised for embeds in Discord, hence 700x350 size.

Shows opengraph image embed in Discord before and after this project.

Local Usage

# Install deps
npm ci

# Generate image
echo Lord of Flames | ./index.js

# Open image
open dist/Lord_of_Flames.webp

Technical Details

The image is generated using Puppeteer, so HTML/CSS can be used to put things into the image with ease.

The contents of the image are mostly generated with Mediawiki, using the Template Sandbox feature to hotswap the main templates to a different one that generates the 700x350 opengraph image box.

The generated images are uploaded to a Cloudflare R2 Public Bucket, exposed at https://cdn.gbf.wiki. Example here.

Automation

To prevent the images from being outdated when the pages are modified or new pages are added, a system is required to automatically detect these changes and update the images.

This is mostly done within this repository with GitHub Actions. The workflow can be found here.

It runs daily and pulls the last modification dates from Cargo to generate the list of changed pages. It then runs Puppeteer to generate the new image, uploads it to R2, and updates the known modification date in the repo.

Links

About

Generates fancy Opengraph Image for gbf.wiki

Resources

License

Stars

Watchers

Forks