Sign in

Footer – how to add date, time… ?

#2502
itips3727

On the demo at: https://getpublii.com/themes/demo/taste/ , it looks like there is a general automatically generated site-wide theme ‘refresh’ date at the top.

And for any specific page (example: https://getpublii.com/themes/demo/taste/christmas-cakes/), there looks to be an automatically generated ‘published on …’ date at the top of the page.

When using the default settings for the Taste template, when you update a page (say for today), the Publii Taste template automatically generates at the bottom of the page ‘This article was updated on April 17, 2020’.

So that provides:

– General site-wide website ‘refresh’ date.
– A ‘published by …’ date for each publicly visible web page / post, and …
– An ‘updated on …’ date for each publicly visible web page / post.

For copyright date, you can enter your:

<p>Copyright &copy; 2020 Your Name.</p>

… text into the Publii Taste, Theme > Custom Settings > Footer box.

Or if you want to have the copyright date automatically update on the first day of each year, just means don’t enter the text above into the Footer box, but instead modify the theme a little for now.

Here’s how.

1. Close Publii.
2. Go to Windows Explorer or Apple Mac Finder.
3. Go to where your Publii Taste site is installed.
4. Go to Publii > sites > [your-taste-them-site-name] > partials > footer.hbs
5. Open footer.hbs.
6. In footer.hbs, go to line 55, then change:

{{#if @config.custom.copyrightText}}

to:

{{#if @config.custom.copyrightText}}

8. Save.

9. Reopen Publii and test your site in Preview. You should see the current year copyright date automatically generated.

But to protect your automatic updating copyright date from when you apply Publii theme updates, it’s best to do the changes above using a theme override as outlined at: https://getpublii.com/dev/theme-overrides/

It’s a bit more involved but protects your changes from being overwritten if you apply an updated version of your Taste theme.

Hope that helps.