/   |  ____  ____  ____ _
  / /| | / __ \/ __ \/ __ `/
 / ___ |/ / / / / / / /_/ /
/_/  |_/_/ /_/_/ /_/\__,_/

A static site generator in go

Inspired by Hugo and Saaru, this static site generator aims to take performance to the next level with parallel rendering, live reload and so much more, all in Go.

Pronounced: /ɐnĖÉ/ which means rice in Kannada šŸš

This Project is a part of the ACM PESU-ECC's yearly AIEP program, and is maintained by Adhesh Athrey, Nathan Paul, Anirudh Sudhir, and Aditya Hegde

Directory structure

The ssg currently requires the following directory structure

ā”œā”€ā”€ /cmd
ā”œā”€ā”€ /pkg
ā”‚Ā Ā  ā”œā”€ā”€ /engine
ā”‚Ā Ā  ā”œā”€ā”€ /helpers
ā”‚Ā Ā  ā””ā”€ā”€ /parser
ā”œā”€ā”€ /site
ā”‚ Ā Ā  ā”œā”€ā”€ /content
ā”‚    ā”‚Ā Ā  ā”‚Ā Ā  ā””ā”€ā”€ /posts
ā”‚    ā”‚   ā”‚           ā””ā”€ā”€ sample.md
ā”‚ Ā Ā  ā”‚Ā Ā  ā””ā”€ā”€ index.md
ā”‚    ā”œā”€ā”€ /layout
ā”‚    ā”‚Ā Ā  ā”œā”€ā”€ config.yml (This file is necessary and cannot be omitted)
ā”‚    ā”‚Ā Ā  ā”œā”€ā”€ page.html (This file is necessary and cannot be omitted)
ā”‚    ā”‚Ā Ā  ā”œā”€ā”€ posts.html (This file is necessary to create a 'Posts' section)
ā”‚    ā”‚Ā Ā  ā””ā”€ā”€ā”€ /partials
ā”‚    ā”‚Ā Ā   Ā Ā  ā””ā”€ā”€ partials for page
ā”‚    ā”œā”€ā”€ /static
ā”‚    ā”‚Ā   ā”œā”€ā”€ /fonts
ā”‚    ā”‚Ā   ā”œā”€ā”€ /images
ā”‚    ā”‚Ā   ā”œā”€ā”€ plane.jpg
ā”‚    ā”‚Ā   ā”œā”€ā”€ /scripts
ā”‚    ā”‚Ā   ā””ā”€ā”€ style.css
ā”‚ Ā Ā  ā”” /rendered (This directory is created by the ssg)
ā””ā”€ā”€ /test (Stores mock data required to test the SSG)
    ā”œā”€ā”€ /engine
    ā”‚Ā Ā  ā”œā”€ā”€ /merged_data_test
    ā”‚Ā Ā  ā”œā”€ā”€ /render_engine_generated
    ā”‚Ā Ā  ā”œā”€ā”€ /render_page
    ā”‚Ā Ā  ā”œā”€ā”€ /render_tags
    ā”‚Ā Ā  ā””ā”€ā”€ /render_user_defined
    ā””ā”€ā”€ /parser
        ā”œā”€ā”€ /input
        ā”œā”€ā”€ /layout
        ā””ā”€ā”€ /parse_md

Description of the directory structure

Building layouts

Each layout file(except posts.html and tags.html) can access any data from the entire ssg

The URL for the current page can be accessed using {{.PageURL}}

To access the data for a particular page, use Go templating syntax:

{{$PageData := index .DeepDataMerge.Templates .PageURL}}

To access the page data for posts.html, tags.html and partials, set {{$PageData := .TemplateData}}

All of the following page data fields can be accessed in the above manner:

In addition to page data, the following fields can be accessed:


  1. Images: To add images, add it to the 'static/' folder or a subdirectory under it. Use /static/[imagename.format] as the image link format in the markdown files.

  2. CSS: CSS can be added in the following ways:

  1. Frontmatter: Metadata such as the title of the page can be added as frontmatter to the markdown files in the YAML format. Currently, the following tags are supported:

(The above tags are Frontmatter tags)

  1. config.yml: This file stores additional information regarding the layout of the site

(The above tags are Layout tags)

Sample config.yml

  - about
  - posts

baseURL: http://localhost:8000/
# Replace this with the actual canonical-url of your site
# baseURL tells search-engines (SEO), web-crawlers (robots.txt) so people can discover your site on the internet.
# It's also embeded in your sitemap / atom feed and can be used to change metadata about your site.

siteTitle: anna
author: Anna

Using Anna locally

Installing from releases

curl -L https://github.com/acmpesuecc/anna/releases/download/<tag>/<release>.tar.gz > anna.tar.gz
tar -xvf anna.tar.gz

Using homebrew on MacOS

brew tap anna-ssg/anna
brew install anna

If you don't have a site dir with the pre-requisite layout template; anna proceeds to fetch the default site dir from our GitHub repository


  anna [flags]

  -a, --addr string   ip address to serve rendered content to (default "8000")
  -d, --draft         renders draft posts
  -h, --help          help for anna
  -l, --layout        validates html layouts
  -p, --prof          enable profiling
  -s, --serve         serve the rendered content
  -v, --version       prints current version number
  -w, --webconsole    wizard to setup anna

Contributing to Anna

Detailed documentation for our SSG can be found: here

If you have git installed, clone our repository and build against the latest commit

git clone github.com/acmpesuecc/anna; cd anna
go build