My Blog'; // Get metadata on all posts from the metadata.json file include_once('_functions/loadJSON.php'); $contentCol .= loadHomepageJSON('_data/metadata.json'); // Create a template include_once('_classes/Template.php'); $template = new Template( $GLOBALS['fullDomain'], 'Explore the thoughts of...', 'Blog | YourName', '', $contentCol, '' ); // Echo the HTML to the user $template->echoTemplate(); } function showPost($params) { // URL Parameter $query = $params[0]; // Get metadata on this post from the metadata.json file include_once('_functions/loadJSON.php'); $headerData = loadPostJSON('_data/metadata.json', $query); // Apply metadata to post header $header = '

' . $headerData->title . '

::#' . $headerData->tag . '
'; // Get post .md file that matches the .html file requested in the URL include_once('_functions/parseMarkdown.php'); $fileName = './posts/' . $headerData->id . '-' . str_replace('.html', '.md', $query); $securedHTML = parseMarkdown($fileName); // Echo Results $contentCol = '
' . $header . '
' . $securedHTML . '
'; // Create a comment section $postURL = $GLOBALS['fullDomain'] . '/post/' . $query; $commentForm = '

Leave a Comment

Comments are saved as Markdown and cannot be edited or deleted.
'; // Load saved comments $userComments = '

Comments

'; $userComments .= loadCommentJSON('_data/comments.json', $query); $userComments .= '
'; // Combine comment form and previous user comments $commentSection = $commentForm . $userComments; // Create a template include_once('_classes/Template.php'); $template = new Template( $GLOBALS['fullDomain'] . '/post/' . $query, $headerData->description . ' Read more at ' . $GLOBALS['fullDomain'] . '!', $headerData->title . ' | Blog', '', $contentCol, $commentSection ); // Echo the HTML to the user $template->echoTemplate(); } function showComments() { // Add title $commentHeader = '

Recent Comments

'; // Load saved comments include_once('_functions/parseMarkdown.php'); include_once('_functions/loadJSON.php'); $userComments = '

Comments Across All Blog Posts

'; $userComments .= loadCommentJSON('_data/comments.json'); $userComments .= '
'; // Combine comment form and previous user comments $commentSection = $commentHeader . $userComments; // Create a template include_once('_classes/Template.php'); $template = new Template( $GLOBALS['fullDomain'] . '/comments/', 'Read through some recent comments for blog posts at ' . $GLOBALS['fullDomain'] . '.', 'Recent Comments | Blog', '', '', $commentSection ); // Echo the HTML to the user $template->echoTemplate(); } function showCategory() { // Open the article list $contentCol = '

Categories

'; // Get metadata on all posts from the metadata.json file include_once('_functions/loadJSON.php'); $contentCol .= loadCategoryJSON('_data/metadata.json'); // Create a template include_once('_classes/Template.php'); $template = new Template( $GLOBALS['fullDomain'] . '/categories/', 'Browse the categories for blog posts at ' . $GLOBALS['fullDomain'] . '.', 'Categories | Blog', '', $contentCol, '' ); // Echo the HTML to the user $template->echoTemplate(); } function showRSS() { // Loop through the metadata file and display any article that is published include_once('_functions/loadRSS.php'); $rssContents = loadRSS('_data/metadata.json'); // Echo the RSS XML header('Content-type: text/xml'); echo $rssContents; die(); } function showRobots() { header('Content-type: text/plain'); echo 'User-agent: * Disallow:'; die(); }