Some instructions on using this blog

Posted on October 21, 2017

This post briefly explains how the blog is organized, and how to create new posts and templates.

This is just a clone of the source's README.md file of the Github sources.

Blog Structure

The sample folder contains an simplified example of the Root contents for a blog. You can override the GOBLOG_ROOT environment variable to point the root to another folder.

The Root contents folders is structured as follows:

  • entries subfolder contains MarkDown entries for each entry of the blog. The name

    • Entries whose file name starts with a timestamp YYYYMMDDname.md will be automatically added to the index.

    • Entries whose file name starts with other pattern will be treated as pages, and will need to link them manually in the template or another entry.

  • static subfolder contains static assets (CSS, images, Javascript files...)

  • template contains the HTML templates in the Golang templating format.

    • The template MUST contain at least two files: index.html for the main index page, and entry.html for the blog entry page.

How to create your blog

Put static assets in static/ folder. They will be accessible through the /static/ URL path.

Put blog entries in entries/ folder as MarkDown documents. They will be accessible through the /entry/ URL path (without extension).

Edit blog template files under the template/ folder.

How to add an entry to your blog

Just add a file in the entries/ folder in a timestamped format. E.g. 201711281330_hello.md will create an entry created at November 28th, 2017 at 13:30.

The markdown file MUST contain a First-level header (e.g. # Post title), that will be used as title of the entry in the entry heading and links.

At this early stage of the blog, you MUST restart the blog process before changes are visible.

Environment variables

  • GOBLOG_PORT (default: 8080)

    • The port where the HTTP service listens
  • GOBLOG_ROOT (default: ../sample)

    • The root folder of the blog contents

Version history

v0.0.8

  • Basic behaviour. Functional, simple blog

TO DO

  • RSS Feed

  • Reload templates or entries when containing folders change

  • Extract first paragraph of entries so you can do a preview

  • Main page shows paginated entries

  • Add 404 page

  • Migrate log to github.com/golang/glog

  • Provide DockerFile

  • Github triggers to upload blog