just-a-blog

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 199fa316b2485205e7392eb6c2ce0a1f76c592b1
parent 35d203d3695e511e5b53f3d2caca71fe68e4e283
Author: Overseer <overseer@mona.qualityreto.net>
Date:   Sat, 24 Feb 2018 00:11:35 -0600

Better handling of posts and pages. Made canonical URLs not default.

Diffstat:
functions.php | 5+++--
header.php | 5+++--
index.php | 2+-
3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/functions.php b/functions.php @@ -30,7 +30,7 @@ function write_html() { function format_name( $name ) { - $returnThisName = preg_replace( "(_)", " ", $name ); + $returnThisName = preg_replace( "(-)", " ", $name ); $returnThisName = substr( $returnThisName, 0, strpos( $returnThisName, ".md" ) ); $returnThisName = ucwords( $returnThisName ); @@ -58,7 +58,8 @@ function post_list() { $output = "\n\t<ul id=\"posts\">"; foreach( $posts as $thisPost ) { - $output .= "\n\t\t<li><a href=\"" . URL . BLOG_DIR . "/post/" . link_name( $thisPost ) . "\">" . date( "Y-m-d", key( $posts ) ) . " - " . format_name( $thisPost ) . "</a></li>"; + # $output .= "\n\t\t<li><a href=\"" . URL . BLOG_DIR . "/post/" . link_name( $thisPost ) . "\">" . date( "Y-m-d", key( $posts ) ) . " - " . format_name( $thisPost ) . "</a></li>"; + $output .= "\n\t\t<li><a href=\"" . URL . BLOG_DIR . "/index.php?post=" . link_name( $thisPost ) . "\">" . date( "Y-m-d", key( $posts ) ) . " - " . format_name( $thisPost ) . "</a></li>"; } $output .= "\n\t</ul>"; diff --git a/header.php b/header.php @@ -1,10 +1,11 @@ <?php $nav = "<ul class=\"nav\">\n"; foreach( $pages as $thisPage ) { - $nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "/page/" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n"; + #$nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "/page/" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n"; + $nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "index.php?page=" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n"; } $nav .= "</ul>"; -$title = "Just a Blog"; +$title = "Just a Blog!"; if( isset( $_GET['page'] ) ) { $thisPage = $_GET['page']; diff --git a/index.php b/index.php @@ -18,7 +18,7 @@ require_once( "functions.php" ); require_once( "lib/parsedown/Parsedown.php" ); /* This should probably be an ini file */ -define( "URL", "http://localhost/" ); +define( "URL", "http://robertdherb.com/" ); if( file_exists( "./blogdir.txt" ) ) { $blogDir = file_get_contents( "blogdir.txt" ); }