Allow DOM <meta name=description content="XYZ Description"> overwrite #4510
-
DescriptionFixed DOM value from src/pages/_document.jsx cannot seemingly be overwritten via custom.js Please provide custom.js or yaml means to overwrite. YAML might be like
If I am wrong and JS does work, I am happy to be corrected on the below :) custom.jsdocument.addEventListener("DOMContentLoaded", function () {
const updateMetaDescription = () => {
let metaDescription = document.querySelector('meta[name="description"]');
if (metaDescription) {
metaDescription.setAttribute("content", "XYZ Description");
console.log("Meta description updated to:", metaDescription.outerHTML);
} else {
let newMetaDescription = document.createElement("meta");
newMetaDescription.setAttribute("name", "description");
newMetaDescription.setAttribute("content", "XYZ Description");
document.head.appendChild(newMetaDescription);
}
};
updateMetaDescription();
setTimeout(updateMetaDescription, 1000);
}); OtherSubject site, docker-compose based with only :/app/config mounted |
Beta Was this translation helpful? Give feedback.
Answered by
shamoon
Dec 29, 2024
Replies: 1 comment
Answer selected by
shamoon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#3828 --> #4513