$content = file_get_contents("404.md"); } /* ** Get some settings. */ $config = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "site-config.php"; if (is_readable($config)) { include_once $config; } else { include_once "md-config.php"; } /* ** Now do the HTML page. */ /* Get page meta data and separate content*/ $md_meta = Md_ParsePage($content); /* Sort out web page title */ if (array_key_exists('title', $md_meta)) { $title = $md_meta['title'] . " | " . $MD_SETTINGS['SITE_NAME']; } else { $title = $MD_SETTINGS['SITE_NAME']; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <?php //Set title echo "<title>" . $title . "</title>\n";
/** * Function Md_GetMetaData reads a Markdown file and pulls out * the content as meta data * @param $file_to_read the full system path to the Markdown file * @return array containing the metadata */ function Md_GetMetaData($file_to_read) { //read contents if (file_exists($file_to_read)) { /* Get page meta data from file content*/ $md_meta = Md_ParsePage(file_get_contents($file_to_read)); } else { $md_meta = array(); } return $md_meta; }