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

Install

Once you have a directory structure, install anna using:

go install github.com/acmpesuecc/anna@latest

Or if you have git installed, clone our repository:

git clone github.com/acmpesuecc/anna --depth=1
cd anna
go run .

Flags

Usage:
  anna [flags]

Flags:
  -a, --addr stringwhich sip address to serve rendered content to (default "8000")
  -d, --draft           renders draft posts
  -h, --help            help for ssg
  -s, --serve           serve the rendered content
  -v, --validate-html   validate semantic HTML