This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

nanogen

A very small static blog generator written in Python.

Purpose

nanogen exists solely so I can have a blogging platform I call my own. If other people find this useful and want to use it, that’s wonderful but it’s not a goal for this project.

The platform is very intentionally bare bones and simple. The code is intentionally utilitarian and less-than-perfect.

If you have an idea for a way to improve this without significantly increasing nanogen’s complexity, please open an issue and let me know. If it’s something I might use, then it’ll get merged. If it isn’t, then I’m sorry.

If you’re looking for a more fully-featured static site generator, may I recommend something like Jekyll or Pelican ?

Installation

The best way to install nanogen is through pip:

$> pip install nanogen

If you don’t want to install it via pip, you can install it manually:

$> git clone https://github.com/epochblue/nanogen
$> cd nanogen
$> python setup.py install

Note : To avoid possible dependency version issues, I advise installing nanogen into a virtual environment, rather than globally.

How To Use

Initializing

Once nanogen is installed, navigate to the directory you’d like to use as your new blog. Our examples will use a blog directory in $HOME:

$> mkdir blog
$> cd blog

Once there, run nanogen’s init command to get started:

$> nanogen init

Running this command will generate the basic directories used by nanogen. When this command completes, the blog directory will look like this:

~/blog
|-- _posts
`-- _layout

These are all the only two folders required by nanogen, and cannot currently be changed by the user. Your individual posts will go in the _posts directory, and the templates will go in the _layouts directory.

At this time, nanogen does not come with a built-in theme, so it’s up to the user to create their own.

Creating Posts

One way to create new posts is by creating a new file in the _posts directory. The filename is important and must match the following rules:

  1. The file can’t start with an underscore (they are ignored)
  2. The file’s name must match the pattern yyyy-mm-dd-<post_title_slug>
  3. The file’s extension must be a valid Markdown extension (md, mdown, or markdown).

To illustrate:

# valid filename
2015-11-01-this-charming-man.md

# invalid filename
15-11-1-bigmouth-strikes-again.txt

If you don’t want to try to remember all that, you can use nanogen’s new command to do it for you. The only required argument to this command is the title of the post being generated:

$> nanogen new "Example Post Title"

Running this will create a properly-named and formatted file in the _posts directory.

Draft posts aren’t an “official” feature of nanogen, however they are possible. By default, when nanogen generates a site it will only look in the _posts folder for files to process. If you’d like to maintain drafts of your posts before you publish them, you can create a _drafts folder next to the _posts folder and nanogen will ignore it during site generation. Alternatively, you can prepend the filename of a drafe with an underscore, and nanogen will skip over it when searching for files to process.

Post Content Format

nanogen posts don’t use YAML front-matter, so the first line of your post will be used for the title of the post. The content of the posts will be processed as Markdown (the Github-flavored variety, complete with syntax-highlighted code blocks). A minimal example of a valid nanogen post is this:

## This will become the title (with hashes stripped out)

**This** will become the post's _content_.

The title will be stripped out of the post’s content, though it will be available to your themes via the post.title attribute.

Generating Your Site

Once you’re ready to generate your site, you can use the build command:

$> nanogen build

This command will walk your _posts directory, process any valid files it finds, and will write all the generated HTML files into a _site folder. Although you will want to preview this on your local development system (see the following section for how to do this), the _site folder can be uploaded to your web host as-is.

Previewing Your Site

To see what your site will look like before you upload it to a live webserver for the world to see, nanogen provides a built-in server that allows you to preview your generated site:

$> nanogen preview

This command will start a server that listens on localhost port 8080. Simply open http://localhost:8080 in a web broswer to see how your site looks. If you’d like to use a different hostname or port, nanogen provides an option for each (-h|--host, and -p|--port, respectively). The following example will start a server that listens on local.dev port 8000 (http://local.dev:8000):

$> nanogen preview --host local.dev --port 8000

Cleaning

If your _site folder somehow gets corrupted, or you’d simply like to generate your site from scratch, you can use the clean command:

$> nanogen clean

There is no undo or confirmation when running this command.

nanogen Themes

Note: nanogen doesn’t provide any themes out of the box. If you’d like to develop your own theme for nanogen, this section should explain how.

nanogen uses Jinja2 for its templating. If you need information about Jinja’s syntax, please refer to their documentation.

Template Files

The templates that make up the theme for your nanogen blog need to be placed in the _layout directory. nanogen only expects a few files to exist, and those files are:

  1. index.html
  2. post.html
  3. rss.xml

index.html will be used as the sites homepage, post.html will be used to generate each individual post, and rss.xml will be be used to generate your blog’s RSS feed.

All of your blog’s posts will be passed to index.html and rss.xml via a Jinja2 context variable named posts (posts will be in reverse chronological order). Individual posts will be passed to post.html via a context variable named post. Each post will have the following relevant attributes available to use in the template:

  • html_content - the HTML version of the post
  • markdown_content - the Markdown version of the post (minus the title)
  • title - the title of the post (will not be processed as Markdown)
  • pub_date - a Python datetime object representing the publish date of the post
  • permalink - the relative URL to the post

Please see the _layout directory in the included example for a basic theme you can use to as a jumping off point for your own theme.

Static Files

If you have any files that you’d like to include in the published site (JavaScript files, CSS files, images, etc), place them into a folder named static inside the _layout folder. This folder will automatically be copied into the _site folder during the build process. No processing will be performed on the files within the static directory.

Sites Using nanogen

License

nanogen is MIT licensed. Please see included LICENSE file for more information.

Release History

Release History

1.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.8.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nanogen-1.0.1.macosx-10.11-x86_64.tar.gz (21.1 kB) Copy SHA256 Checksum SHA256 any Dumb Binary Aug 28, 2016
nanogen-1.0.1.tar.gz (7.6 kB) Copy SHA256 Checksum SHA256 Source Aug 28, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting