Little trick code
I think that it is a bad idea by default to use handlebars to handle the NEW badge, because it causes that if your website won’t be updated for a long time, the very old posts will be marked as “NEW”.
Please consider such case:
- Add to your post items attribute e.g. data-publish-date – put on this attribute date attribute: https://getpublii.com/dev/date-helper/
- The attribute should contain date timestamp – you can achieve this using “x” as a date format: https://momentjs.com/docs/#/parsing/string-format/
- Then create a script which will compare date timestamp and for posts newer than e.g. 2 weeks will add the “NEW” badge
Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!