I'm currently working on a cms that will have an alert appear on multiple pages. I am currently using an if statement to have the alert appear only a page with a specific page title. Is there a way of generalizing it and having it appear on all articles with the word "Test" in the title?
At the moment my logic is if @pageTitle === "Test Article Two
display....
I tried doing @pageTitle === "Test"
but that only shows on the article that has the title Test rather then other titles with the word Test in them.
Here is my code :
<script>
if(document.title === "Test Article Two") {
document.body.classList.add("show-alert");
}
</script>