Refine homepage shortcode layout and rendering cleanup
This commit is contained in:
@@ -33,6 +33,26 @@ Shortcodes::register('hero', static function (array $attrs = []): string {
|
||||
return $html;
|
||||
});
|
||||
|
||||
Shortcodes::register('home-catalog', static function (array $attrs = []): string {
|
||||
$releaseLimit = max(1, min(12, (int)($attrs['release_limit'] ?? 8)));
|
||||
$artistLimit = max(1, min(10, (int)($attrs['artist_limit'] ?? 6)));
|
||||
$chartLimit = max(1, min(20, (int)($attrs['chart_limit'] ?? 10)));
|
||||
|
||||
$hero = Shortcodes::render('[hero eyebrow="Catalog Focus" title="Latest Drops" subtitle="Fresh releases, artists, and best sellers." cta_text="Browse Releases" cta_url="/releases" secondary_text="Meet Artists" secondary_url="/artists"]');
|
||||
$releases = Shortcodes::render('[latest-releases limit="' . $releaseLimit . '"]');
|
||||
$artists = Shortcodes::render('[new-artists limit="' . $artistLimit . '"]');
|
||||
$chart = Shortcodes::render('[sale-chart type="tracks" window="latest" limit="' . $chartLimit . '"]');
|
||||
$newsletter = Shortcodes::render('[newsletter-signup title="Join the list" button="Subscribe"]');
|
||||
|
||||
return '<section class="ac-home-catalog">'
|
||||
. $hero
|
||||
. '<div class="ac-home-columns">'
|
||||
. '<div class="ac-home-main">' . $releases . $chart . '</div>'
|
||||
. '<aside class="ac-home-side">' . $artists . $newsletter . '</aside>'
|
||||
. '</div>'
|
||||
. '</section>';
|
||||
});
|
||||
|
||||
return function (Router $router): void {
|
||||
$controller = new PagesController();
|
||||
$router->get('/page', [$controller, 'show']);
|
||||
|
||||
Reference in New Issue
Block a user