Add url based title to each exhibition
This commit is contained in:
parent
35351bc709
commit
2b79d762b3
2 changed files with 22 additions and 6 deletions
16
site/controllers/home.php
Normal file
16
site/controllers/home.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
return function ($page) {
|
||||
|
||||
// Get exhibitions field content (stored as yaml) and parse it to return an array
|
||||
$exhibitions = $page->exhibitions()->yaml();
|
||||
|
||||
// Add url based title to each exhibition
|
||||
foreach ($exhibitions as &$exhibition) {
|
||||
$exhibition['title'] = str_replace(['http://', 'https://', 'www.'], '', $exhibition['url']);
|
||||
}
|
||||
|
||||
return [
|
||||
'exhibitions' => $exhibitions
|
||||
];
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue