Set up CV page

This commit is contained in:
Paul Nicoué 2025-05-30 17:15:12 +02:00
parent 18c60b22cd
commit 098b8b8e0d
14 changed files with 117 additions and 31 deletions

18
site/controllers/cv.php Normal file
View file

@ -0,0 +1,18 @@
<?php
return function ($kirby, $site) {
// Get shared data from default controller (site.php)
$shared = $kirby->controller('site' , compact('site'));
// Get CV field content
$cv = $site->cv();
// Return merged arrays containing shared data and current controller data
return A::merge(
$shared,
compact(
'cv',
)
);
};

View file

@ -1,17 +1,24 @@
<?php
return function ($site) {
return function ($kirby, $site) {
// Get shared data from default controller (site.php)
$shared = $kirby->controller('site' , compact('site'));
// Get CV page URL and override logo href and aria-label attributes
$logoHref = page('cv')->url();
$logoAriaLabel = "Go to {$site->title()}'s CV page";
// Get items from image gallery structure field
$galleryItems = $site->image_gallery()->toStructure();
// Get contact fields content
$email = $site->email();
$instagram = $site->instagram();
return [
'galleryItems' => $galleryItems,
'email' => $email,
'instagram' => $instagram,
];
// Return merged arrays containing shared data and current controller data
return A::merge(
$shared,
compact(
'galleryItems',
'logoAriaLabel',
'logoHref',
)
);
};

20
site/controllers/site.php Normal file
View file

@ -0,0 +1,20 @@
<?php
return function ($site) {
// Get site URL (home page URL) to potentially override logo href and aria-label attributes in other templates
$logoHref = $site->url();
$logoAriaLabel = "Go to {$site->title()}'s home page";
// Get contact fields content
$email = $site->email();
$instagram = $site->instagram();
// Return data
return compact(
'email',
'instagram',
'logoAriaLabel',
'logoHref',
);
};