diff --git a/utils/build.js b/utils/build.js index 8725e15..9fc8a79 100644 --- a/utils/build.js +++ b/utils/build.js @@ -43,23 +43,12 @@ async function build() { // get images for (const issue of issues) { - const imgResp = await fetch("https://html2svg.gwei.cz", { - method: 'POST', - body: JSON.stringify({ - url: `https://news.web3privacy.info/image/${issue.week}?${new Date().valueOf()}`, - format: "png", - width: 1920, - height: 960, - }) - }); - - const imgFn = join(imgDir, `${issue.week}.png`) - if (imgResp.body) { - const file = await Deno.open(imgFn, { write: true, create: true }); - await imgResp.body.pipeTo(file.writable); - } + await genImage(`https://news.web3privacy.info/image/${issue.week}?${new Date().valueOf()}`, join(imgDir, `${issue.week}.png`)) } + // make cover + await genImage(`https://news.web3privacy.info/cover`, join(imgDir, 'cover.png')) + const outputFn = join(DEST_DIR, "index.json"); await writeJSONFile(outputFn, issues); } @@ -91,4 +80,21 @@ async function writeJSONFile(fn, data) { return Deno.writeTextFile(fn, JSON.stringify(data, null, 2)); } +async function genImage(url, fn) { + const imgResp = await fetch("https://html2svg.gwei.cz", { + method: 'POST', + body: JSON.stringify({ + url, + format: "png", + width: 1920, + height: 960, + }) + }); + + if (imgResp.body) { + const file = await Deno.open(fn, { write: true, create: true }); + await imgResp.body.pipeTo(file.writable); + } +} + build(); \ No newline at end of file diff --git a/web/src/components/MetaTags.astro b/web/src/components/MetaTags.astro new file mode 100644 index 0000000..b12b811 --- /dev/null +++ b/web/src/components/MetaTags.astro @@ -0,0 +1,25 @@ +--- + +const { title, description, image } = Astro.props; +--- + + + +