Snippet to dynamically add the year or a custom dynamic date to your page.html.twig file. In your mytheme.theme file, first add:

 * Implements hook_preprocess_page().
function mytheme_preprocess_page(&$variables) {
  $variables['year'] = date('Y', time());

Now, in your page.html.twig you can use:

{{ year }}
// Prints '2020'


Saved you some valuable time?

Donate and get more free time-saving code on this website in the future.