- Generated SEO titles/descriptions per gym; gym seo fields override each on its own - Keywords, author, og:site_name, favicon and JSON-LD logo follow the gym - CrossFit page 404s before output for gyms without a box - Events: «Mostrar em» gym selector; event page uses its gym's brand - Hero event button text colour from the event colour (--ev-on) - Navbar bottom line stops at the other-gym head (--switch-w) - Diagonal hero blur mask; remove the trial link
56 lines
2.5 KiB
PHP
56 lines
2.5 KiB
PHP
<?php
|
|
// JSON-LD structured data for the gym (rendered inside <head> by include.php).
|
|
// Built from fitme3070_info + work_hours so admin edits stay in sync.
|
|
$ld_gym = current_gym();
|
|
$ld = [
|
|
'@context' => 'https://schema.org',
|
|
'@type' => 'ExerciseGym',
|
|
'name' => $ld_gym['name'] !== '' ? $ld_gym['name'] : (($info['name'] ?? '') !== '' ? $info['name'] : 'FitMe 3070'),
|
|
'url' => gym_url($ld_gym),
|
|
'image' => base_url(img_compat_rel(($ld_gym['hero_image'] ?? '') !== '' ? $ld_gym['hero_image'] : 'site/assets/img/home.jpg')),
|
|
'logo' => base_url(img_compat_rel(gym_logo($ld_gym) ?: 'site/assets/img/logos/logo_black.svg')),
|
|
];
|
|
if (!empty($info['phone'])) $ld['telephone'] = site_tel($info['phone']);
|
|
if (!empty($info['email'])) $ld['email'] = $info['email'];
|
|
if (!empty($info['adress'])) {
|
|
$ld['address'] = [
|
|
'@type' => 'PostalAddress',
|
|
'streetAddress' => $info['adress'],
|
|
'addressLocality' => ($ld_gym['locality'] ?? '') !== '' ? $ld_gym['locality'] : 'Mira',
|
|
'addressCountry' => 'PT',
|
|
];
|
|
}
|
|
if (!empty($info['google_maps_link'])) $ld['hasMap'] = $info['google_maps_link'];
|
|
|
|
$ld_same_as = array_values(array_filter([$info['facebook'] ?? '', $info['instagram'] ?? '']));
|
|
if ($ld_same_as) $ld['sameAs'] = $ld_same_as;
|
|
|
|
// Opening hours: the 'segunda' row in work_hours covers Mon-Fri (see index.php).
|
|
$ld_days = [
|
|
'segunda' => ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
|
|
'sabado' => ['Saturday'],
|
|
'domingo' => ['Sunday'],
|
|
];
|
|
$ld_hours = [];
|
|
foreach ((isset($GLOBALS['pdo']) ? site_work_hours($GLOBALS['pdo']) : []) as $h) {
|
|
if (!isset($ld_days[$h['week_day']])) continue;
|
|
$ld_hours[] = [
|
|
'@type' => 'OpeningHoursSpecification',
|
|
'dayOfWeek' => $ld_days[$h['week_day']],
|
|
'opens' => substr((string) $h['open'], 0, 5),
|
|
'closes' => substr((string) $h['close'], 0, 5),
|
|
];
|
|
}
|
|
if ($ld_hours) $ld['openingHoursSpecification'] = $ld_hours;
|
|
?>
|
|
<script type="application/ld+json">
|
|
<?= json_encode($ld, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) ?>
|
|
</script>
|
|
<?php /* A dynamic page (e.g. an event landing page) can attach its own JSON-LD
|
|
— such as an Event schema — via this global, set before _open.php runs. */ ?>
|
|
<?php if (!empty($GLOBALS['_jsonld_extra'])): ?>
|
|
<script type="application/ld+json">
|
|
<?= json_encode($GLOBALS['_jsonld_extra'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) ?>
|
|
</script>
|
|
<?php endif; ?>
|