#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import ogImageMap from "@editor/data/ogImageMap.json";
// Generated by scripts/generate-og-metadata.mjs from the tool registry +
// public/og_images. Maps a tool id to its OG image basename; tools with no
// bespoke art are absent and fall back to the default below.
const TOOL_OG_IMAGES = ogImageMap as Record<string, string>;
const DEFAULT_OG_IMAGE = "home";
/**
* Resolve the Open Graph image URL for a tool. Image filenames historically
* follow URL slugs / legacy v1 names rather than the camelCase tool id, so the
* basename must come from the generated map, not from the tool id directly.
*/
export const getToolOgImage = (
baseUrl: string,
toolId: string | null,
): string => {
const basename = (toolId && TOOL_OG_IMAGES[toolId]) || DEFAULT_OG_IMAGE;
return `${baseUrl}/og_images/${basename}.png`;
};