Commit ·
40554bf
1
Parent(s): 35a6af1
added dope stuff
Browse files
frontend/scripts/render-blog-svg-covers.mjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
| 1 |
-
import fs from "node:fs/promises";
|
| 2 |
-
import path from "node:path";
|
| 3 |
-
import { fileURLToPath } from "node:url";
|
| 4 |
-
import puppeteer from "puppeteer-core";
|
| 5 |
-
|
| 6 |
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
| 7 |
-
const BLOG_DIR = path.resolve(__dirname, "../public/blog");
|
| 8 |
-
const SIZE = { width: 1200, height: 630 };
|
| 9 |
-
|
| 10 |
-
const INPUTS = [
|
| 11 |
-
"blog-cover-biggest-update-magazine-captions-custom-templates",
|
| 12 |
-
"blog-cover-stock-visualizer",
|
| 13 |
-
];
|
| 14 |
-
|
| 15 |
-
async function fileExists(filePath) {
|
| 16 |
-
try {
|
| 17 |
-
await fs.access(filePath);
|
| 18 |
-
return true;
|
| 19 |
-
} catch {
|
| 20 |
-
return false;
|
| 21 |
-
}
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
async function resolveExecutablePath() {
|
| 25 |
-
if (process.env.PUPPETEER_EXECUTABLE_PATH) {
|
| 26 |
-
return process.env.PUPPETEER_EXECUTABLE_PATH;
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
const candidates = [
|
| 30 |
-
"C:/Program Files/Google/Chrome/Application/chrome.exe",
|
| 31 |
-
"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
| 32 |
-
"C:/Program Files/Microsoft/Edge/Application/msedge.exe",
|
| 33 |
-
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
|
| 34 |
-
];
|
| 35 |
-
|
| 36 |
-
for (const candidate of candidates) {
|
| 37 |
-
if (await fileExists(candidate)) {
|
| 38 |
-
return candidate;
|
| 39 |
-
}
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
return undefined;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
async function main() {
|
| 46 |
-
const executablePath = await resolveExecutablePath();
|
| 47 |
-
const browser = await puppeteer.launch({
|
| 48 |
-
...(executablePath ? { executablePath } : { channel: "chrome" }),
|
| 49 |
-
headless: true,
|
| 50 |
-
args: ["--no-sandbox", "--force-color-profile=srgb", "--hide-scrollbars", "--lang=en-US"],
|
| 51 |
-
});
|
| 52 |
-
|
| 53 |
-
try {
|
| 54 |
-
const page = await browser.newPage();
|
| 55 |
-
await page.setViewport({ ...SIZE, deviceScaleFactor: 1 });
|
| 56 |
-
|
| 57 |
-
for (const baseName of INPUTS) {
|
| 58 |
-
const svgPath = path.join(BLOG_DIR, `${baseName}.svg`);
|
| 59 |
-
const pngPath = path.join(BLOG_DIR, `${baseName}.png`);
|
| 60 |
-
const svg = await fs.readFile(svgPath, "utf8");
|
| 61 |
-
|
| 62 |
-
await page.setContent(
|
| 63 |
-
`<html><body style="margin:0;background:transparent"><div id="capture-root" style="width:${SIZE.width}px;height:${SIZE.height}px;overflow:hidden">${svg}</div></body></html>`,
|
| 64 |
-
{ waitUntil: "load" }
|
| 65 |
-
);
|
| 66 |
-
|
| 67 |
-
const el = await page.$("#capture-root");
|
| 68 |
-
if (!el) {
|
| 69 |
-
throw new Error(`Capture root missing for ${baseName}`);
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
await el.screenshot({ path: pngPath, type: "png" });
|
| 73 |
-
console.log(`Rendered ${path.basename(pngPath)}`);
|
| 74 |
-
}
|
| 75 |
-
} finally {
|
| 76 |
-
await browser.close();
|
| 77 |
-
}
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
main().catch((err) => {
|
| 81 |
-
console.error(err);
|
| 82 |
-
process.exit(1);
|
| 83 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/src/content/blogPosts.ts
CHANGED
|
@@ -9246,7 +9246,7 @@ export const blogPosts: BlogPost[] = [
|
|
| 9246 |
description:
|
| 9247 |
"A new Magazine template puts you on the cover of TIME, automatic captions now run on every video, and a Custom Template Generator lets you build your own look — plus upgrades across every existing template.",
|
| 9248 |
category: "Product updates",
|
| 9249 |
-
heroImage: "/blog/blog-cover-biggest-update-magazine-captions-custom-templates.
|
| 9250 |
heroImageAlt:
|
| 9251 |
"Blog2Video's biggest update: a TIME-style Magazine cover template, automatic captions, and a custom template generator.",
|
| 9252 |
publishedAt: "2026-07-03",
|
|
@@ -9523,7 +9523,7 @@ export const blogPosts: BlogPost[] = [
|
|
| 9523 |
description:
|
| 9524 |
"Blog2Video's free stock visualizer pulls live price history and financial statements for any ticker, styled after Newscast, Bloomberg Terminal, and Newspaper visual themes. Here's why we built it and how finance publishers are using it.",
|
| 9525 |
category: "Product Update",
|
| 9526 |
-
heroImage: "/blog/blog-cover-stock-visualizer.
|
| 9527 |
heroImageAlt:
|
| 9528 |
"Blog2Video free stock data visualizer showing SPCX price chart in Bloomberg Terminal, Newscast, and Newspaper themes alongside income statement and balance sheet tables.",
|
| 9529 |
publishedAt: "2026-06-30",
|
|
|
|
| 9246 |
description:
|
| 9247 |
"A new Magazine template puts you on the cover of TIME, automatic captions now run on every video, and a Custom Template Generator lets you build your own look — plus upgrades across every existing template.",
|
| 9248 |
category: "Product updates",
|
| 9249 |
+
heroImage: "/blog/blog-cover-biggest-update-magazine-captions-custom-templates.png",
|
| 9250 |
heroImageAlt:
|
| 9251 |
"Blog2Video's biggest update: a TIME-style Magazine cover template, automatic captions, and a custom template generator.",
|
| 9252 |
publishedAt: "2026-07-03",
|
|
|
|
| 9523 |
description:
|
| 9524 |
"Blog2Video's free stock visualizer pulls live price history and financial statements for any ticker, styled after Newscast, Bloomberg Terminal, and Newspaper visual themes. Here's why we built it and how finance publishers are using it.",
|
| 9525 |
category: "Product Update",
|
| 9526 |
+
heroImage: "/blog/blog-cover-stock-visualizer.png",
|
| 9527 |
heroImageAlt:
|
| 9528 |
"Blog2Video free stock data visualizer showing SPCX price chart in Bloomberg Terminal, Newscast, and Newspaper themes alongside income statement and balance sheet tables.",
|
| 9529 |
publishedAt: "2026-06-30",
|