This commit is contained in:
Ty Clifford
2026-05-20 21:08:23 -04:00
commit 6ab3058a92
187 changed files with 18355 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
config-custom.php
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Painted Sky Studios
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+1712
View File
File diff suppressed because it is too large Load Diff
+60
View File
@@ -0,0 +1,60 @@
# Dead Simple Blog
Version 1.1 (2022-11-15)
- [Installation](#installation)
- [Usage](#usage)
- [Changelog](#changelog)
- [Other Versions](#other-versions)
- [Attributions](#attributions)
I've wanted for a long time to create a simple way of blogging that eschews basically all bells and whistles. Many "flat file" Content Management Systems exist already, as well as "static site generators", but none of these that I looked at were simple enough for my liking.
I don't want to have to install Ruby, or Python, or Composer, or whatever else on a server to run a blog. On the other hand, installing WordPress or one of the other popular PHP-based CMSes for this use case is like hammering in a nail with a sledgehammer.
Many people dislike PHP, and while it has its warts, I like it. I like using (vanilla) PHP simply because it is nearly ubiquitous. Having to install or configure it is often unnecessary because it is usually *already* installed, configured, and running.
I wanted to use plain text files, but some formatting is nice -- Markdown was the obvious solution for this, since it offers quite a lot of options in terms of text formatting, without sacrificing the readability of the plain text itself. I was not keen on adding dependencies but I found [Parsedown](http://parsedown.org) which offers Markdown parsing by including a single PHP file. I can deal with that.
That's really all there is to it -- dead simple PHP-based templating, and Markdown-formatted plain text content.
I know I'm probably forgetting about a million edge cases, but I want to keep it simple. So, we'll roll with this for now and add features as they become necessary.
## Installation
Download the files and upload them to a webserver somewhere. That's it!
## Usage
1. Duplicate `config-default.php` as `config-custom.php`, and change the config variables to your liking.
2. Create text files with a NUMERIC file name, I use YYYY-MM-DD date-based names (e.g. 2018-10-30.md).
3. Format text files with Markdown, or not. Whatever. ;)
4. If you need to link to image/video/audio/etc. files, you can upload them to the media folder.
4. Upload text files to the `content` directory.
5. You're done!!
## Changelog
### Version 1.1
- Updated Parsedown to 1.7.4
- Config has now been moved to `config-default.php`, added support for `config-custom.php`
- Added dark mode! Adjust the `APPEARANCE` constant to enable
- Change default file type to .md files instead of .txt. Adjust `FILE_EXT` constant if needed
- Reorganize folder structure (CSS and fonts are now in `/src`)
- Small text update to `/content/drafts/AboutDrafts.md`
- Defined `$content` in global scope to avoid PHP errors in some configurations
- Added default favicon at `/img/favicon.png`
- Including `fonts.css` in `<head>` instead of using @import for better caching behaviour
- Added file hash query strings to `<link>` tags in `<head>` for better caching behaviour
- `index.php` now uses `<main>` for content on list view and `<article>` on single post view
- List view now explicitly sorts posts using `sortPosts()` function - default is sorting by filename, descending
## Other Versions
User @shoaiyb has a fork going with additional features that I didn't think were "absolutely necessary" but if you want some extra bells and whistles, I recommend checking out [his fork](https://github.com/shoaiyb/dead-simple-blog).
## Attributions
- [Parsedown](https://github.com/erusev/parsedown) by Emanuil Rusev
- [Blog Icon](https://thenounproject.com/icon/blog-3557350/) by Gregor Cresnar from [Noun Project](https://thenounproject.com)
+20
View File
@@ -0,0 +1,20 @@
<?php
// WARNING: This file is provided for convenience, not security.
// This file is NOT meant to keep secret information or credentials of any kind.
// The settings below are benign, but please don't add custom variables in here
// unless you know what you're doing.
define('BLOG_TITLE', 'Ty\'s List (of blurbs)');
// URL of the homepage. Can be absolute or relative.
define('BASE_URL', '/i/');
// Contact email is shown as a link in the footer.
define('CONTACT_EMAIL', 'ty@tyclifford.com');
// The type of files used for your content. Usually 'md' or 'txt'
define('FILE_EXT', 'md');
// light or dark mode
define('APPEARANCE', 'dark');
+8
View File
@@ -0,0 +1,8 @@
# Hm?
Still working on things.
<video width="320" height="240" controls>
<source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
+13
View File
@@ -0,0 +1,13 @@
# Moving along
This is NOW the new website look! It'll grow over time of course, and *maybe* more functionality. So far:
- Still no advertisements
- Reduced footprint
And... reduced footprint in itself makes a huge difference. I used to think the previous website was a good way to go for layouts, but nope. I eventually wanted even *less*.
Previous posts will slowly be migrated over.
Thank you for reading... if you do.
+9
View File
@@ -0,0 +1,9 @@
# Draft Posts
Draft posts can be put in this folder, they will not be included in the listing of posts until they are moved up into the parent folder.
## Warning!
Permissions on this folder are set to User Read/Write ONLY, which will prevent the general public from accessing the text files directly. But beware, if these folder permissions are overwritten then those files will be viewable.
I will probably do up some Apache and nginx configurations that will secure this in a more reliable way, but in the meantime if you're not sure, you can always save your drafts offline.
Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

+134
View File
@@ -0,0 +1,134 @@
<?php
require_once('Parsedown.php');
require_once('../cfip.php');
// Default config is now found in 'config-default.php', but it's best not to edit that directly.
// Instead, duplicate it and rename the new version 'config-custom.php' (no quotes).
// If you're using Git for version control, add config-custom.php to your .gitignore.
// Then you can do pull/fetch/rebase in Git and it won't overwrite your config.
if (file_exists('config-custom.php')) {
require_once('config-custom.php');
} else {
require_once('config-default.php');
}
$content = '';
$is_post = !empty($_GET['post']); // Whether we're viewing the main list or a single post
function sortPosts($a, $b) {
$a_value = $a->getFilename();
$b_value = $b->getFilename();
return strcmp($b_value, $a_value); // Reversed to get descending
}
if ( $is_post ) {
// Single post page
$post_name = filter_var($_GET['post'], FILTER_SANITIZE_NUMBER_INT);
$file_path = __DIR__.'/content/'.$post_name.'.'.FILE_EXT;
if ( file_exists($file_path) ) {
$file = fopen($file_path, 'r');
$post_title = trim(fgets($file),'#');
fclose($file);
// Process the Markdown
$parsedown = new Parsedown();
$content = $parsedown->text(file_get_contents($file_path));
} else {
$content = '
<h2>Not Found</h2>
<p>Sorry, couldn\'t find a post with that name. Please try again, or go to the
<a href="'.BASE_URL.'">home page</a> to select a different post.</p>';
}
} else {
// Blog main page - list all posts
$files = new DirectoryIterator(__DIR__.'/content/');
$files_array = [];
foreach ($files as $file) {
if ( $file->isFile() && $file->getExtension() == FILE_EXT ) {
array_push($files_array, $file->getFileInfo());
}
}
usort($files_array, 'sortPosts'); // See sortPosts() function above
foreach ($files_array as $file) {
$filename_no_ext = $file->getBasename('.'.FILE_EXT);
$file_pointer = $file->openFile();
$post_title = trim($file_pointer->fgets(),'#');
$content .= '<p class="is-social-minimal-light"><a class="link-1 aqua" href="'.BASE_URL.'?post='.$filename_no_ext.'">'.$post_title.'</a> '.$filename_no_ext.'</p>';
}
}
// Appending file hashes to the <link> hrefs allows us to cache the files indefinitely,
// but immediately serve a new version once the file changes.
$style_hash = hash('md5', file_get_contents(__DIR__.'/src/css/style-'.APPEARANCE.'.css'));
$fonts_hash = hash('md5', file_get_contents(__DIR__.'/src/css/fonts.css'));
$icon_hash = hash('md5', file_get_contents(__DIR__.'/img/favicon.png'));
?>
<!DOCTYPE html>
<html>
<head>
<title><?php if ( !empty($_GET['post']) ) { echo $post_title.' - '; } ?><?php echo BLOG_TITLE; ?></title>
<meta charset="utf-8">
<meta name="description" content="The web space of Ty Clifford" />
<meta name="author" content="Ty Clifford">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Ty Clifford, Keyser, West Virginia, United States, Nerd, Ty on TikTok, Ty's web space, Freedom of Expression">
<meta property="og:url" content="https://tyclifford.com/?mtm_campaign=homepage" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Ty Clifford - Hobbies are my hobby." />
<meta property="og:title" content="Ty Clifford - Hobbies are my hobby." />
<meta property="og:image" content="https://tyclifford.com/images/fa2.jpg" />
<meta property="og:image:alt" content="Profile image of Ty Clifford. Making a funny face squinting, Eye everything." />
<meta name="twitter:site" content="@_tyclifford" />
<meta name="twitter:title" content="Ty Clifford" />
<meta name="twitter:description" content="Ty's space" />
<!-- FAV and TOUCH ICONS -->
<link rel="shortcut icon" href="../images/ico/fa-bl.ico">
<link rel="apple-touch-icon" href="../images/ico/fa-bl.jpg"/>
<!-- FONTS -->
<link rel="stylesheet" type="text/css" href="../css/fonts/hk-grotesk/style.css">
<link rel="stylesheet" type="text/css" href="../css/fonts/fontello/css/fontello.css">
<!-- STYLES -->
<link rel="stylesheet" type="text/css" href="../css/main.css">
<!-- Video -->
</head>
<body class="is-text-align-left is-masked-dark is-text-light" style="background-color:black;">
<!-- CONTENT-WRAP -->
<div class="content-wrap">
<!-- CONTENT -->
<div class="content">
<h4><a href="index.php"><span class="highlight purple">Ty's List (of blurbs)</span></a></h4>
<?php
$tag = $is_post ? 'article' : 'main';
echo '<'.$tag.'>'.$content.'</'.$tag.'>';
?>
<hr />
<p class="is-social-minimal-light"><a class="social-link github" href="https://github.com/snick512/tyclifforddotcomland"></a> <a class="social-link email" href="mailto:ty@tyclifford.com"></a> <a class="social-link twitter" href="https://twitter.com/_tyclifford"></a></p>
</div>
<!-- CONTENT -->
</div>
<!-- CONTENT-WRAP -->
<!-- SCRIPTS -->
<script src="../js/main.js"></script>
</body>
</html>
+36
View File
@@ -0,0 +1,36 @@
@font-face {
font-family: 'lato';
src: url('../fonts/lato/lato-regular-webfont.woff2') format('woff2'),
url('../fonts/lato/lato-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'lato';
src: url('../fonts/lato/lato-italic-webfont.woff2') format('woff2'),
url('../fonts/lato/lato-italic-webfont.woff') format('woff');
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: 'lato';
src: url('../fonts/lato/lato-bold-webfont.woff2') format('woff2'),
url('../fonts/lato/lato-bold-webfont.woff') format('woff');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: 'lato';
src: url('../fonts/lato/lato-bolditalic-webfont.woff2') format('woff2'),
url('../fonts/lato/lato-bolditalic-webfont.woff') format('woff');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'slabo_13px';
src: url('../fonts/slabo13px/slabo13px-regular-webfont.woff2') format('woff2'),
url('../fonts/slabo13px/slabo13px-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
+83
View File
@@ -0,0 +1,83 @@
body {
color: #fff;
background: #333;
font: 18px 'lato', sans-serif;
line-height: 1.5;
}
body>* {
max-width: 40em;
margin: 0 auto;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'slabo_13px', 'lato', sans-serif;
}
a,
a:link,
a:visited {
color: #0bf;
transition: color .2s ease;
}
a:hover {
color: #09d;
}
a:active {
color: #057;
}
header {
border-bottom: 1px solid #555;
}
h1.blog-title a {
text-decoration: none;
}
h2.list-title a {
color: #fff;
text-decoration: none;
}
h1.blog-title a:hover,
h2.list-title a:hover {
text-decoration: underline;
}
h2.list-title a:hover {
color: #ddd;
}
code {
font: normal 1em 'Inconsolata', monospace;
color: #fb557e;
background: #222;
padding: 0 .33em;
border-radius: .33em;
}
hr {
border: none;
border-top: 1px solid #555;
}
footer {
color: #ddd;
padding: 0 1em;
margin: 2em auto 0;
background: #444;
box-sizing: border-box;
overflow: auto;
}
footer .postscript {
font-style: italic;
}
+82
View File
@@ -0,0 +1,82 @@
body {
color: #333;
background: #fff;
font: 18px 'lato', sans-serif;
line-height: 1.5;
}
body>* {
max-width: 40em;
margin: 0 auto;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'slabo_13px', 'lato', sans-serif;
}
a,
a:link,
a:visited {
color: #08c;
transition: color .2s ease;
}
a:hover {
color: #0bf;
}
a:active {
color: #046;
}
header {
border-bottom: 1px solid #ccc;
}
h1.blog-title a {
text-decoration: none;
}
h2.list-title a {
color: #000;
text-decoration: none;
}
h1.blog-title a:hover,
h2.list-title a:hover {
text-decoration: underline;
}
h2.list-title a:hover {
color: #ddd;
}
code {
font: normal 1em 'Inconsolata', monospace;
color: #fb557e;
background: #eee;
padding: 0 .33em;
border-radius: .33em;
}
hr {
border: none;
border-top: 1px solid #ccc;
}
footer {
color: #888;
padding: 1em;
margin: 2em auto 0;
background: #eee;
box-sizing: border-box;
}
footer .postscript {
font-style: italic;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.