<?php
global $EXTERNAL_BASEURL;
$title = is_null($this->title)? 'Iowa Environmental Mesonet': "IEM :: {$this->title}";
// Page should refresh
$refresh = "";
if ($this->refresh > 0){
  $refresh = sprintf("<meta http-equiv=\"refresh\" content=\"%s;\">",
    $this->refresh);
}
// Include headextra last so that CSS overrides work
$headextra = "";
if ($this->iemss){
  $headextra .= <<<EOF
<link rel="stylesheet" href="/vendor/openlayers/10.8.0/ol.css" type="text/css">
<link rel="stylesheet" href="/css/iemss.css" type="text/css">
EOF;
}
if ($this->iemselect2) {
    $headextra .= <<<EOM
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.bootstrap5.css" rel="stylesheet">
EOM;
}
if ($this->jsani){
    $headextra .= <<<EOM
<link rel="stylesheet" href="/vendor/jquery-ui/1.12.1/jquery-ui.min.css">
<link rel="stylesheet" href="/vendor/jquery-ui/1.12.1/jquery-ui.theme.min.css">
<link rel="stylesheet" href="/vendor/jsani/2.84/jquery.jsani.min.css">
EOM;
}
$headextra .= is_null($this->headextra) ? '': $this->headextra;
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <?php echo $refresh; ?>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $title; ?></title>
    <meta name="description" content="Iowa State University, Iowa Environmental Mesonet">
    <meta name="author" content="daryl herzmann akrherz@iastate.edu">

    <link href="/vendor/bootstrap/5.3.6/css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap Icons for UI and navigation -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
    <link href="/css/iastate-iem.css" rel="stylesheet">

    <!-- Any page specific headextra content here -->
    <?php echo $headextra; ?>

    <!-- Essential Social Tags -->
    <meta property="og:title" content="<?php echo $title; ?>">
    <meta property="og:description" content="<?php echo $this->twitter_description; ?>">
    <meta property="og:image" content="<?php echo $EXTERNAL_BASEURL . $this->twitter_image; ?>">
    <meta property="og:url" content="<?php echo $EXTERNAL_BASEURL .htmlentities($_SERVER["REQUEST_URI"]); ?>">
    <?php if (!is_null($this->twitter_video)){
        echo <<<EOM
    <meta property="og:type" content="video">
    <meta property="og:video" content="{$EXTERNAL_BASEURL}{$this->twitter_video}">
    <meta property="og:video:type" content="video/mp4">
    <meta property="og:video:width" content="{$this->twitter_video_width}">
    <meta property="og:video:height" content="{$this->twitter_video_height}">

EOM;
    } ?>
    <meta name="twitter:card" content="<?php echo $this->twitter_card; ?>">

    <!-- Non-essential -->
    <meta name="twitter:creator" content="@akrherz">
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/apple-touch-icon-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-precomposed.png">
  </head>

  <body>
    <a href="#main-content" class="visually-hidden-focusable">Skip to main content</a>
