diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-08-02 18:03:17 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-08-02 18:03:17 -0300 |
commit | cadeb88fac5d121d13ef517a043c0577d3e8b880 (patch) | |
tree | 873575e7eda02f5df1e4ef98ea50a6c29d981438 /src/write | |
parent | ed55527ca510cd93bb035e3466e30ed6197928d9 (diff) |
content, infra: support social embeds
Diffstat (limited to 'src/write')
-rw-r--r-- | src/write/build-modes/live-dev-server.js | 2 | ||||
-rw-r--r-- | src/write/build-modes/static-build.js | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js index 1f74df1e..6734c065 100644 --- a/src/write/build-modes/live-dev-server.js +++ b/src/write/build-modes/live-dev-server.js @@ -365,7 +365,7 @@ export async function go({ args: page.contentFunction.args ?? [], }); - const pageHTML = topLevelResult.toString(); + const {pageHTML} = topLevelResult.content; if (!quietResponses) console.log(`${requestHead} [200] ${pathname}`); response.writeHead(200, contentTypeHTML); diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js index 2a5e1437..8bc1b242 100644 --- a/src/write/build-modes/static-build.js +++ b/src/write/build-modes/static-build.js @@ -309,10 +309,11 @@ export async function go({ args: page.contentFunction.args ?? [], }); - const pageHTML = topLevelResult.toString(); + const {pageHTML, oEmbedJSON} = topLevelResult.content; return writePage({ - html: pageHTML, + pageHTML, + oEmbedJSON, outputDirectory: path.join(outputPath, getPagePathname({ baseDirectory, device: true, @@ -333,10 +334,10 @@ export async function go({ }); const target = to('localized.' + toPath[0], ...toPath.slice(1)); - const html = generateRedirectHTML(title, target, {language}); + const pageHTML = generateRedirectHTML(title, target, {language}); return writePage({ - html, + pageHTML, outputDirectory: path.join(outputPath, getPagePathname({ baseDirectory, device: true, @@ -387,14 +388,14 @@ import { } from 'fs/promises'; async function writePage({ - html, + pageHTML, oEmbedJSON = '', outputDirectory, }) { await mkdir(outputDirectory, {recursive: true}); await Promise.all([ - writeFile(path.join(outputDirectory, 'index.html'), html), + writeFile(path.join(outputDirectory, 'index.html'), pageHTML), oEmbedJSON && writeFile(path.join(outputDirectory, 'oembed.json'), oEmbedJSON), |