- Issue created by @jsidigital
- Status changed to Closed: won't fix
2 days ago 6:25pm 16 December 2024
I am using the Metatag module and there we can enter the field "Expire" in GMT format to show when the page will expire.
To make it dynamic I want to use javascript to do this using:
<script type="text/javascript">
const now = new Date();
const tomorrow = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 7, now.getHours(), now.getMinutes(), now.getSeconds());
const rfc1123DateString = tomorrow.toUTCString();
document.write(rfc1123DateString);
</script>
I tried to create a new custom token type called "cache-expire" using this code.
So this token was created: "[cache-expires:7day]" using the code above and I added this token to the metatag module.
Problem is that the javascript is not processed so the actual token shows the javascript code and not the actual GMT format date.
Does this module support javascript for the tokens? If so, how? Not sure what I did wrong.
I have a text format called "javascript". I tested this code on a regular page and the code displays the GMT date correctly, just not in this custom token module.
How do you recommend I make this work?
Sorry, I am not very familiar with this module.
Any assistance or guide you may provide is greatly appreciated.
Active
Code