Keeping your footer updated

Old Footer Dates ... No More! Image

We have all seen sites where the footer says something like ©2019, Our Great Company, LLC.

Now, if it is actually 2019, that is great. But if not, it just seems, well, sloppy. It will not matter how amazing the site is. Or if it’s a personal blog or a huge company website. We will lose trust and confidence in it, even before we start browsing.

But let us be fair. If you are a web developer, you have probably forgotten to update the footer on a site once or twice — I know I have. But there is an easy cure for this, built right into ExpressionEngine.

Make ExpressionEngine do the Work

Here is how you make ExpressionEngine update your footer to always show the correct year.

  1. Let us start by looking at an example where the year is hardcoded:

    <footer id="footer">
     <p class="copyright">&copy;2020 Thomas Boelskifte &amp; <br />All rights reserved.</p>

    Note: If you have your footer-code in a Template Variable, you need to move it to a Template Partial. Because Template Variables can only hold static information, Template Partials can hold dynamic tags and information. You can read more about the difference here.

    Placing the footer-code in a Template Variable is normally perfectly sound, since it’s static content that very rarely changes. But, because we want to use the {current_time} Global Variable to update the year, we have to place the code somewhere that allows this.

    And that would often be a Template Partial that we then add to all of our sites’ pages. That way any future changes will only have to be made in that one place. This goes for footers as well as headers, sidebars and so on.

  2. OK, let us update our code so that ExpressionEngine updates the year for us. We do this with the {current_time} Global Variable.

    You can read more about the {current_time} variable in the ExpressionEngine documentation here. And you can find out more about date and time formatting here.

    We simply replace the hardcoded year with the {current_time format="%Y"} Global Variable, formatted to only show the year and no date or time:

    <footer id="footer">
     <p class="copyright">&copy; {current_time format="%Y"} Thomas Boelskifte &amp;</p>

That is all there is to it. If you have questions or comments, don’t hesitate to post them below.

Inspiration and links

The footer is an oft-overlooked part of a website, and that is a pity. It’s a great place to make sure visitors can find the less prominent but still important parts of a site. The footer can even serve as a mini sitemap, where everything is easily accessible.

If you would like to do some further work on your own website’s footer, I found the following articles useful and inspirational while writing this guide:

Thank you for reading. I hope you found this mini-guide useful.

Author: Thomas Boelskifte

Posted: August 13, 2021 | Updated: October 29, 2021


Write a Comment:

Note: You can use markdown for your comment.

Previous Comments:

I was curious if you ever thought of changing the structure of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the wayy of content so people could connect with it better. Youve got ann awful lot of text for only having one or 2 pictures. Maybe you could space it out better?

Also visit myy blog: fakku dating