Anna

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

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

/anna
ā”œā”€ā”€ /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

Layout

The layout files can access the following rendered data from the markdown files:

Notes

  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

navbar:
  - 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
siteScripts:
author: Anna

Run locally

go run github.com/acmpesuecc/anna@v1.0.0-alpha

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

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
Usage:
  anna [flags]

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