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/content | |
parent | ed55527ca510cd93bb035e3466e30ed6197928d9 (diff) |
content, infra: support social embeds
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/dependencies/generatePageLayout.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js index 706340cc..490468c9 100644 --- a/src/content/dependencies/generatePageLayout.js +++ b/src/content/dependencies/generatePageLayout.js @@ -210,6 +210,7 @@ export default { to, }) { const colors = getColors(slots.color ?? data.wikiColor); + const hasSocialEmbed = !html.isBlank(slots.socialEmbed); let titleHTML = null; @@ -522,7 +523,7 @@ export default { footerHTML, ].filter(Boolean).join('\n'); - return html.tags([ + const pageHTML = html.tags([ `<!DOCTYPE html>`, html.tag('html', { @@ -601,7 +602,10 @@ export default { */ - // slots.socialEmbed, + hasSocialEmbed && + slots.socialEmbed + .clone() + .slot('mode', 'html'), html.tag('link', { rel: 'stylesheet', @@ -636,6 +640,16 @@ export default { }), ]), ]) - ]); + ]).toString(); + + const oEmbedJSON = + (hasSocialEmbed + ? slots.socialEmbed + .clone() + .slot('mode', 'json') + .content + : null); + + return {pageHTML, oEmbedJSON}; }, }; |