Auto-Linkify Words

I don’t know what it’s worth, but I asked ChatGPT for a way to add a backend checkbox to toggle between target=“_self” and target=“_blank”. Here’s what it suggested:

Code for settings.yaml:

self_target:
  type: bool
  default: false
  client: true

Code for initialize-discourse-linkify.js:

  let createLink = function (text, url) {
	let link = document.createElement("a");
	link.innerHTML = text;
	link.href = url;
	link.rel = "nofollow";
	link.target = settings.self_target ? "_self" : "_blank"; // Use the admin setting here
	link.className = "linkify-word no-track-link";
	return link;
  };

Do you think this might work ?