Footer – how to add date, time… ?
-
April 17, 2020 at 2:18 pm #2500[anonymous]
When synchronizing the webpage, if set for a footer in settings, there could be some current info about dates generated. It would be useful for copyright or for providing of the information when the webpbage was updated. That would avoid the need to manualy update such data when the webpage is static. User could insert some text and/or graphics plus date/time in pre-defined format. Example: %Logo.png © %YYYY MyCompany, Inc. Someone suggested that this is possible in theme settings. I do not see it there. Using Taste (v.1.8.1.0) In settings I see similar options for posts, but not in the footer. Would be also nice to have a logo there, time to time. Any ideas?
April 17, 2020 at 2:44 pm #2502[anonymous]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 © 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}}
{{{@config.custom.copyrightText}}}to:
{{#if @config.custom.copyrightText}}
{{{@config.custom.copyrightText}}} Copyright © {{@utils.currentYear}} Your name.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.
April 17, 2020 at 3:11 pm #2503[anonymous]Thank you <span class=”f-author-name”>itips3727</span> for taking your time to create this detailed tutorial. I will test it later and I am very sure it will work. So I will use it I guess. It would be nice, anyway, to have this as a simple option in the program when we can see that set for posts already. We can close the topic here because of your kind contribution. 🙂