outgoing internal links contain nofollow attribute in woodmart
-
Hi,
have you a suggestion for this problem ?? tks
Hi Carlo,
Thanks for reaching to us.
Please provide me with mentioned url so I can take a look.
Regards,
Hung PD
Hello, you see the attached information. tks
Hi Carlo,
Thanks for your patience.
Can you please let me know which specific parts you want to remove nofollow attr?
Regards,
Hung PD
HI,
internal links no needs nofollow attr, if you show me as fix it, i will do it. more 500 links has this problem.
Needs a fast solution. Tks
Hi Carlo,
Thanks for your patience.
Currently, in order to remove the nofollow attribute, you need to use custom JS, which should be added in Theme settings > Custom JS > Global JS.
document.addEventListener("DOMContentLoaded", function() {
const links = document.querySelectorAll("a[rel~='nofollow']");
links.forEach(link => {
try {
const url = new URL(link.href, window.location.origin);
if (url.hostname === window.location.hostname) {
let rel = link.getAttribute("rel").split(" ")
.filter(r => r.toLowerCase() !== "nofollow");
if (rel.length > 0) {
link.setAttribute("rel", rel.join(" "));
} else {
link.removeAttribute("rel");
}
}
} catch(e) {
}
});
});
Regards,
Hung PD