diff --git a/web/src/html.js b/web/src/html.js
index 8463180a2..508819834 100644
--- a/web/src/html.js
+++ b/web/src/html.js
@@ -23,13 +23,17 @@ const { getJsBundleId } = require('../bundle-id.js');
const jsBundleId = getJsBundleId();
function insertToHead(fullHtml, htmlToInsert) {
- return fullHtml.replace(
- /.*/s,
- `
- ${htmlToInsert || buildOgMetadata()}
-
- `
- );
+ const beginStr = '';
+ const finalStr = '';
+
+ const beginIndex = fullHtml.indexOf(beginStr);
+ const finalIndex = fullHtml.indexOf(finalStr);
+
+ if (beginIndex > -1 && finalIndex > -1 && finalIndex > beginIndex) {
+ return `${fullHtml.slice(0, beginIndex)}${
+ htmlToInsert || buildOgMetadata()
+ }${fullHtml.slice(finalIndex + finalStr.length)}`;
+ }
}
function truncateDescription(description) {