What is the best method to create global site / page footer

I have a home page with a footer section made of 3 textarea fields in the home.yml

footC:
	label: Footer Centre
	type: textarea
	help: The Centre text
footL:
	label: Footer Left
	type: textarea
	help: The Left Area
footR:
	label: Footer Right
	type: textarea
	help: The Right area

How another page “somepage.php” reference the home page content.
I started writing a controller …

<?php

return function($page) {
   
   $fleft = get('footL');
   $fcent = get('footC');
   $fright = get('footR');

   $alert = null;

   return [
      'footLeft' => $fleft,
      'footCentre' => $fcent,
      'footRight' => $fright,

   ];


};

But I’m not sure how to progress from here.

You can put your footer fields in site.yml instead of home.yml. The fields will be available on all pages.

1 Like

You can access any page using the page helper with a path to the page

page('home')?->fieldname()

But I agree, this data would be better off in the site object if you want to use it throughout the site

1 Like

Thanks @sly31 and @texnixe soo simple :slight_smile: