Method to get current year? #763
-
I'm attempting to display a copyright year on my email template but I'm unsure of a method where I can get the date without using javascript. If I write a script it gets compiled to the production template instead of printing the value so I'm wondering if there's something in the configs I can just pull out and place as a variable like I did with the frontmatter in the templates. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
I think that you can use a function for that. In config.js: current_year: function() {
return new Date().getFullYear()
} In your template:
|
Beta Was this translation helpful? Give feedback.
-
oh nice! This works. To provide the wisdom of the ancients, here's exactly what I did to achieve this:
Then in my layout I added the following code:
You can add this to your template files as well. |
Beta Was this translation helpful? Give feedback.
-
You don't have to do it in both config files. They are merged together. |
Beta Was this translation helpful? Give feedback.
I think that you can use a function for that.
In config.js:
In your template: