diff --git a/2017/includes/class-Header.php b/2017/includes/class-Header.php index 0dcc218..f83cc1d 100644 --- a/2017/includes/class-Header.php +++ b/2017/includes/class-Header.php @@ -1,172 +1,187 @@ . class Header { static function spawn($menu_uid = null, $args = [] ) { $menu = menu_entry($menu_uid); $args = array_replace( [ 'show-title' => true, 'nav' => true, 'nav-title' => SITE_NAME_SHORT, 'head-title' => null, 'title' => $menu->name, 'url' => $menu->url, 'not-found' => false, 'user-navbar' => true, 'container' => true, 'alert' => null, 'alert.type' => null, 'noindex' => NOINDEX ], $args ); + // adjust the URL for our convenience + if( $args['url'] ) { + + // force an absolute URL + $args['url'] = site_page( $args['url'], true ); + + // force to that language (TODO) + // $args['url'] = keep_url_in_language( $args['url'] ); + } + + // eventually force to this correct permalik + if( $args['url'] && FORCE_PERMALINK ) { + force_permalink( $args['url'] ); + } + if( ! isset( $args['og'] ) ) { $args['og'] = []; } $args['og'] = array_replace( [ 'image' => STATIC_URL . '/ld-2017-logo-470.png', // It's better an absolute URL here 'type' => 'website', 'url' => $args['url'], 'title' => $args['title'] ], $args['og'] ); if( $args['head-title'] === null ) { $args['head-title'] = sprintf( __("%s - %s"), $args['title'], $args['nav-title'] ); } header('Content-Type: text/html; charset=' . CHARSET); if( $args['not-found'] ) { header('HTTP/1.1 404 Not Found'); } enqueue_css('materialize'); enqueue_css('materialize.custom'); enqueue_css('materialize.icons'); enqueue_js('jquery'); enqueue_js('materialize'); // Close header - Start $args['container'] && inject_in_module('footer', function() { ?> getISO(); } else { $l = 'it'; } ?>
;
;