From d1fa284d6adc7a65187941c32ec0f371fa0a682a Mon Sep 17 00:00:00 2001 From: Matt Netkow Date: Thu, 15 Feb 2024 16:33:42 -0600 Subject: [PATCH 1/4] add beamer --- docusaurus.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docusaurus.config.js b/docusaurus.config.js index 98326bd74a3..2693caa74ce 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -325,4 +325,11 @@ module.exports = { ], customFields: {}, themes: [], + scripts: [ + "var beamer_config = { product_id : 'mUvQtqly31065' };", + { + src: 'https://app.getbeamer.com/js/beamer-embed.js', + defer: true, + }, + ] }; From fa143c23ca128cb9e7beca00394ceb7c522210de Mon Sep 17 00:00:00 2001 From: Matt Netkow Date: Thu, 15 Feb 2024 17:22:00 -0600 Subject: [PATCH 2/4] working! --- docusaurus.config.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 2693caa74ce..1ef3058f841 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -322,14 +322,28 @@ module.exports = { versions: VERSIONS_JSON, }, ], + function (context, options) { + return { + name: 'beamer', + injectHtmlTags({content}) { + return { + // For performance, Beamer recommends injecting these scripts at the very bottom of the + // Thus, custom plugin is required here to use postBodyTags + postBodyTags: [ + ``, + { + tagName: 'script', + attributes: { + src: 'https://app.getbeamer.com/js/beamer-embed.js', + defer: 'defer', + } + } + ] + }; + } + }; + }, ], customFields: {}, themes: [], - scripts: [ - "var beamer_config = { product_id : 'mUvQtqly31065' };", - { - src: 'https://app.getbeamer.com/js/beamer-embed.js', - defer: true, - }, - ] }; From d1b8460072b8c0a40621a5c7fe508d2d40c5126b Mon Sep 17 00:00:00 2001 From: Matt Netkow Date: Mon, 26 Feb 2024 11:49:15 -0600 Subject: [PATCH 3/4] production only --- docusaurus.config.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 1ef3058f841..906342e0bed 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -326,20 +326,23 @@ module.exports = { return { name: 'beamer', injectHtmlTags({content}) { - return { - // For performance, Beamer recommends injecting these scripts at the very bottom of the - // Thus, custom plugin is required here to use postBodyTags - postBodyTags: [ - ``, - { - tagName: 'script', - attributes: { - src: 'https://app.getbeamer.com/js/beamer-embed.js', - defer: 'defer', + // Only inject Beamer when deployed to production, so we don't use up Beamer "users" + if (process.env.NODE_ENV === "production") { + return { + // For performance, Beamer recommends injecting these scripts at the very bottom of the + // Thus, custom plugin is required here to use postBodyTags + postBodyTags: [ + ``, + { + tagName: 'script', + attributes: { + src: 'https://app.getbeamer.com/js/beamer-embed.js', + defer: 'defer', + } } - } - ] - }; + ] + }; + } } }; }, From 4b8fbc894c06e93947b3e84fb8561db9501f58a9 Mon Sep 17 00:00:00 2001 From: Matt Netkow Date: Thu, 29 Feb 2024 10:32:31 -0600 Subject: [PATCH 4/4] linted --- docusaurus.config.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 0558e487647..877ff0d625f 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -370,9 +370,9 @@ module.exports = { function (context, options) { return { name: 'beamer', - injectHtmlTags({content}) { + injectHtmlTags({ content }) { // Only inject Beamer when deployed to production, so we don't use up Beamer "users" - if (process.env.NODE_ENV === "production") { + if (process.env.NODE_ENV === 'production') { return { // For performance, Beamer recommends injecting these scripts at the very bottom of the // Thus, custom plugin is required here to use postBodyTags @@ -383,12 +383,12 @@ module.exports = { attributes: { src: 'https://app.getbeamer.com/js/beamer-embed.js', defer: 'defer', - } - } - ] + }, + }, + ], }; } - } + }, }; }, ],