# Gophertype

This is a simple web blog engine written in Go.

## Dependencies

This app expects you to have a Redis cache server running on localhost. Redis
is used for rate limiting and to cache Pygments code highlight blocks in
Markdown files.

The Python `pygmentize` program should also be available if you want code
highlight in Markdown.

## Usage

For database, this app can use SQLite, MySQL or PostgreSQL; use **one** of the
options. Easiest is to use a SQLite database for local development.

```bash
Usage of gophertype:
  -bind string
    	Bind address for HTTP server (default ":8000")
  -debug
    	Debug level logging
  -mysql string
    	Use MySQL database, format: user:password@/dbname?charset=utf8&parseTime=True&loc=Local
  -postgres string
    	Use Postgres database, format: host=myhost port=myport user=gorm dbname=gorm password=mypassword
  -root string
    	User root for custom web pages (default "./public_html")
  -sqlite3 string
    	Use SQLite database, default 'database.sqlite'
  -v	Show version number and exit (alias)
  -version
    	Show version number and exit
```

Example:

```bash
gophertype -debug -sqlite database.sqlite -root ./public_html
```

## Architecture

Gophertype runs on a dual templating system: it has its own built-in store of
default pages to run the core features of the blog, and a public user root for
your own pages and you can override the built-in defaults by creating files with
the same name.

The `pvt-www/` folder contains the built-in templates (these get bundled into
the binary when compiled), and `public_html` is the default user root (which you
can change with the `-root` command line parameter).

## Pages and Markdown Support

Everything under the user root is basically served as static files from disk, so
you can arrange images and JavaScript paths and embed everything as normal.

A couple types of files are handled specially:

* Go templates (`*.gohtml`) are processed with the html/template module.
* Markdown files (`*.md`) are supported and will render as HTML wrapped in
  an HTML template providing your blog's normal layout and decorations.

## License

Copyright 2022 Noah Petherbridge, all rights reserved.