From cc9ac872b78989918425974836fa5ec2056bd0c9 Mon Sep 17 00:00:00 2001 From: Quy Date: Thu, 5 Dec 2024 14:27:10 -0500 Subject: [PATCH] add description meta tag --- src/views/Papers/Research/main.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/views/Papers/Research/main.js b/src/views/Papers/Research/main.js index 36a8571c8..ba98d75ee 100644 --- a/src/views/Papers/Research/main.js +++ b/src/views/Papers/Research/main.js @@ -1171,6 +1171,26 @@ new Vue({ if (content[0]["title"] != false) { document.title = content[0]["title"]; } + + //set page description + if (content[0]["description"] != false) { + let metaDesc = document.querySelector( + 'meta[name="description"]' + ); + if (metaDesc) { + metaDesc.setAttribute( + "content", + content[0]["description"] + ); + } else { + let meta = document.createElement("meta"); + meta.name = "description"; + meta.content = content[0]["description"]; + document + .getElementsByTagName("head")[0] + .appendChild(meta); + } + } } },