Skip to content

Commit

Permalink
Changes to RSS Feed, Home Page post list, and template
Browse files Browse the repository at this point in the history
Added a favicon example, changed the RSS Feed to only included the most
recent 30 posts, changed the home page to show full content of X number
of posts and summary titles of Y number of posts, followed by the link
to the archive. Template now includes RSS link in header, and RSS
button at top of post list. Main logo is now a link back to home page.
  • Loading branch information
Gregory Naçu committed Mar 6, 2017
1 parent ec5aed0 commit af4a9a1
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 13 deletions.
Binary file added src/favicon.ico
Binary file not shown.
7 changes: 6 additions & 1 deletion src/feed.php
Expand Up @@ -16,11 +16,16 @@

$posts = array();

$postLimit = 30;

for($i=$postsInfo["count"];$i>0;$i--) {
if(!$postLimit--)
break;

$info = file_get_contents("posts/".$i.".json");
$info = json_decode($info,true);

$articleDesc = trim(preg_replace('/\s\s+/', ' ', strip_tags(file_get_contents("posts/".$i.".html",false,null,0,200))));
$articleDesc = trim(preg_replace('/\s\s+/', ' ', strip_tags(file_get_contents("posts/".$i.".html",false,null,0,200)))).". . .";

$postContent = "
<item>
Expand Down
42 changes: 32 additions & 10 deletions src/index.php
@@ -1,6 +1,7 @@
<?php

define("MAX_HOME_POSTS",10);
define("MAX_HOME_POSTS", 15);
define("MAX_HOME_FULLPOSTS",10);

$template = file_get_contents("template-main.html");

Expand All @@ -18,26 +19,47 @@

for($i=$postCount,$j=0;$i>0&&$j<MAX_HOME_POSTS;$i--,$j++) {
$info = file_get_contents("posts/".$i.".json");
$body = file_get_contents("posts/".$i.".html");

$info = json_decode($info,true);

$postContent = "
<a name='".$info["slug"]."' class='slug'><div class='date'>".$info["date"]."<em>".$info["type"]."</em><hr></div></a>
<h3><a href='post?p=".$i."#post' class='title'>".$info["title"]."</a></h3>
if($j < MAX_HOME_FULLPOSTS) {
$body = file_get_contents("posts/".$i.".html");

$postContent = "
<a name='".$info["slug"]."' class='slug'><div class='date'>".$info["date"]."<em>".$info["type"]."</em><hr></div></a>
<h3><a href='post?p=".$i."#post' class='title'>".$info["title"]."</a></h3>
<div class='comments'><a href='post?p=".$i."#disqus_thread' data-disqus-identifier='".$info["slug"]."'></a></div>
<div class='comments'><a href='post?p=".$i."#disqus_thread' data-disqus-identifier='".$info["slug"]."'></a></div>
".$body."
";
".$body."
";
}

else {
$postContent = "
<a name='".$info["slug"]."' class='slug'><div class='date'>".$info["date"]."<em>".$info["type"]."</em><hr></div></a>
<h3><a href='post?p=".$i."#post' class='title'>".$info["title"]."</a></h3>
";

//Injects a header above these post summaries
if($j == MAX_HOME_FULLPOSTS) {
$postContent = "
<a name='olderposts' class='slug'><div class='date'>Older Posts<em>Click titles to see full content</em><hr></div></a>
<p>
The home page shows the full content of the 10 most recent posts.<br>
Below are the titles of 5 posts older than the most recent 10.<br>
Click their titles to view the complete post and read and leave comments.
</p>
".$postContent;
}
}

$posts[] = $postContent;
}


$posts[] = "
<a name='viewarchive' class='slug'><div class='date'>Archive<hr></div></a>
<h3><a href='archive#post' class='title'>View Archived Posts</a></h3>
<h3><a href='archive#post' class='title'>Full Archive of Past Posts</a></h3>
";

$template = str_replace("<!--{post}-->",implode("\n\n",$posts),$template);
Expand Down
Binary file added src/resources/c64c-profile-crop.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/resources/icon-rss-subscribe.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions src/template-main.html
Expand Up @@ -8,6 +8,9 @@
<style type='text/css'>

</style>

<link href="http://www.c64os.com/feed" rel="alternate" type="application/rss+xml" title="A blog about making a C64 useful in a modern world. Tracks the development progress of C64 OS, an event driven and network oriented unitasking OS for stock C64." />

<link rel="stylesheet" href='resources/main.css' />
<link rel="stylesheet" href='resources/bigfoot-default.css' />

Expand All @@ -20,7 +23,7 @@
</head>
<body onload='initNotesAndZoom();'>
<div class='logo'>
<img src='resources/logo-c64os-transparent.png' alt='C64 OS Logo' width="600" height="200"><br>
<a href="/"><img src='resources/logo-c64os-transparent.png' alt='C64 OS Logo' width="600" height="200"></a><br>
Written and Maintained by Greg Nacu
</div>

Expand Down Expand Up @@ -331,7 +334,10 @@ <h2>Video</h2>
</div>

<div class='blog'>
<a name="post" class='post'><h2>Development Progress Blog</h2></a>
<div class='posthead'>
<a name="post" class='post'><h2>Development Progress Blog</h2></a>
<a href='http://www.c64os.com/feed'><img src='resources/icon-rss-subscribe.png' class='rssbutton' alt='Subscribe to C64OS.com with your favorite RSS Reader'></a>
</div>

<div><!--{post}--></div>

Expand All @@ -344,6 +350,9 @@ <h2>Video</h2>
<form action='search' method='get'>
<input type='text' name='q' placeholder='Search c64os.com'> <input type='submit' value='Search'>
</form>
<span>
Powered by <a href="https://github.com/gnacu/ubl">Ultralight Blogging Platform</a>, By Gregory Nacu
</span>
</div>

<script type='text/javascript'>
Expand Down

0 comments on commit af4a9a1

Please sign in to comment.