Simple, no-database blog framework
PHP HTML CSS ApacheConf
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
controllers
models
parsedown
posts
static
tests
views
.gitignore
.htaccess
LICENSE.txt
README.md
config.json
index.php

README.md

Charles W. Reace's Simple (I Hope) Blog Framework

The intent here is something where I can just upload markdown files for each article, and this will organize them by date and parse the markdown into HTML. As a result, there is no admin interface, as the only "admin" you need to do is use (S)FTP or whatever other method you prefer to upload your post files.

Installation

Download or pull this repo. For now, it will only work from your web root directory. (I have an open issue to change that.) (fixed!) Edit the /.config.json file with desired values for your site.

Blog Posts

Posts are stored as markdown files in the /posts directory. You need a home page file called home.md there. Any other posts should start with a date, be all lower-case, and using underscores where you would logically have a space, e.g. 2016-08-38_my_new_post.md. (Note that the date portion controls the sorting, so use a "Y2K-compliant" style date in YYYY-MM-DD format.) The Parsedown package is used to convert the file to HTML. Additionally, I added code to convert " -- " (space, double-hypen, space) to HTML entities for thin-space, em-dash, thin-space. The CSS (in /static/css/style.css) makes any image tags within the post float left.

If you use the /static/img/ directory for images in your posts, use a relative URL (no leading slash), such as static/img/your_image.jpg.

Images

The /static/img directory should contain an image file named banner.jpg to be used as the background image in the page's banner. (I used a 2,048px × 532px jpeg which seemed to work pretty well). You can also put a favicon.ico file there to be used as the blog's favicon. You can use this directory to upload images you want to use in your posts, if desired.

Views

cwrBlog makes use of CSS Grid for multiple screen size support. There are a few items in /config.json that are used for values in the head and foot views.

  • banner_title is the site "name" displayed in the banner at the top of every page
  • title_part_one is used for the title element within the head section
  • copyright_name is who you want to list as owning the copyright to the blog content
  • copyright_year is the earliest year you want listed in the copyright statement

Right Column content

Edit the /views/right_column.php file for whatever you'd like to appear in that column (google search, links to other sites, whatever you like).

Tests

I added a few PHPUnit tests, more as a way to sanity-check things when I make any changes. To run them, you'll need to install PHPUnit.phar, then run it from the base project directory:

> phpunit tests

To-Do

Trying to decide if I want to add reader comment capability, and if so, how.