Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more functions to notification template parsing #1263

Merged
merged 1 commit into from
Mar 26, 2023

Conversation

justinbeaty
Copy link
Contributor

I wanted to add a copyright notification in the footer of my newsletters. I can use the Date function in the campaign body, but not in any of the static/email-templates/*.html files.

 {{ define "footer" }}
     </div>
     
     <div class="footer">
         <p>{{ L.T "public.poweredBy" }} <a href="https://listmonk.app" target="_blank">listmonk</a></p>
+        <small>&copy; {{ Date "2006" }}</small>
     </div>
     <div class="gutter">&nbsp;</div>
 </body>
 </html>
 {{ end }}

Try to add the above modification, and:

$ ./listmonk --static-dir=static
2023/03/25 15:30:13 main.go:99: v2.4.0 (c668523 2023-03-20T13:50:31Z)
2023/03/25 15:30:13 init.go:138: reading config: config.toml
2023/03/25 15:30:13 init.go:266: connecting to db: /var/run/postgresql/:5432/listmonk
2023/03/25 15:30:14 init.go:225: loading static files from: static
2023/03/25 15:30:14 init.go:585: media upload provider: filesystem
2023/03/25 15:30:14 init.go:615: error parsing e-mail notif templates: template: base.html:94: function "Date" not defined

This PR adds in the Date function, as well as sprig functions.

@knadh knadh merged commit a955102 into knadh:master Mar 26, 2023
@knadh knadh added the enhancement New feature or request label Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants