We need to add a disclaimer or disclosure to certain posts (about 100 of them and counting). The disclosure might change in the future, so I would like to add [DISCLOSURE-GOES-HERE] to each of the 100 posts. We can add it manually, that’s no problem. But when we update our disclosure in the future, I only want to change it one place.
What I’ve tried:
-
Watched Words. The problem is that existing posts do not show the updated disclosure until you edit the post. That defeats the purpose for this use case.
-
Javascript to replace innerHTML of the element. I must have done it wrong- this caused errors about replacing a child node:
<script type="text/discourse-plugin" version="0.8">
var disclosures = "• Important Disclosures: We are not responsible, etc, etc."
api.decorateCooked($elem => {
var el = $elem[0];
el.innerHTML = el.innerHTML.replace('[DISCLOSURE-GOES-HERE]', disclosures);
});
</script>
-
Auto-linkify theme component. Love it for other things, but I want to display the disclosure text, not a link to the disclosure.
-
I know you can replace text from the rails console, but I want moderators to maintain it.