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; +--- + + + +{title} + + + + + + + + + + + + + + + + + diff --git a/web/src/layouts/base.astro b/web/src/layouts/base.astro index d0cc820..0d89fd6 100644 --- a/web/src/layouts/base.astro +++ b/web/src/layouts/base.astro @@ -1,15 +1,23 @@ --- import '../styles/base.css'; import config from '../config.yaml'; +import MetaTags from '../components/MetaTags.astro'; + +const { title, description, image } = Astro.props; + --- - - - {config.name} | Web3Privacy Now + + +
diff --git a/web/src/pages/cover.astro b/web/src/pages/cover.astro new file mode 100644 index 0000000..45f0cea --- /dev/null +++ b/web/src/pages/cover.astro @@ -0,0 +1,21 @@ +--- +import '../styles/base.css'; +import config from '../config.yaml'; + +--- + + + + +
+
+
{config.name}
+
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/web/src/pages/issue/[week].astro b/web/src/pages/issue/[week].astro index 496998d..8a23a51 100644 --- a/web/src/pages/issue/[week].astro +++ b/web/src/pages/issue/[week].astro @@ -2,6 +2,7 @@ import BaseLayout from '../../layouts/base.astro'; import WeekNews from '../../components/WeekNews.astro'; import issues from '../../issues.json'; +import config from '../../config.yaml'; export function getStaticPaths() { return issues.map(issue => { @@ -16,7 +17,11 @@ const issue = issues.find(item => item.week === week); --- - +