sites115

a static sites generator with search functionality

How to Install on Linux

  1. Run in the terminal sudo snap install sites115

How to Use

  1. To create a site called sitename run sites115 cs sitename.
  2. To render a site and start the development server, run sites115 dev sitename for a site called sitename
  3. To deploy use docker. The dockerfile needed is part of the created site.

Folder Structure

Conventions used in folder stuffs

  1. Every folder must contain a ‘index.html’ for the path /

  2. Every sub-folder of stuffs must contain a toc.txt. Sample of a toc.txt is as follows:

    
    how_to_blog.md
    on_css_frameworks.md
    long_running_tasks.md
    

  3. Every html or markdown file must begin with a variables part. It must begin with --- and end with ---. Sample contents include

    template: base.html
    title: Saenuma - A beautiful programs website
    meta: Saenuma homepage. Saenuma delivers beautiful programs.
    keywords: programs, database, program, forms, git, stories
    

    it must contain the variables: template, title, meta and keywords. You can include your own variables.

  4. Include a ‘404.html’ in your stuffs folder for not found pages.

  5. Include a ‘search_results.html’ in your stuffs folder for results of a search

  6. A markdown file must have the template and the md_template variables.

Conventions used in the folder templates

  1. All templates files must not begin with a variables section.
  2. The template kind in use is golang’s html/template.

Structs that would be passed to your templates

Page

Which is of type map[string]string that would contain your page variables.

This is passed to all html pages and markdown pages.

Paginator

Which is declared as

type PaginatorStruct struct {
  Page int
  PaginationCount int
  Pages []map[string]string
  TotalPages int
  TotalPagesArr []int
}

Where Pages is a list of Page variables declared above. This Page variables would also contain a url field

Paginator object is passed to the ‘index.html’ and the ‘search_results.html’ pages.

SearchStr

Contains the query for example. s=bank+account

This is passed to the ‘search_results.html’ pages.

HTML

Contains a HTML generated from markdown.

This is passed to the markdown pages.

Functions Passed to Your HTML Templates and Markdown files

ToLower func(string) string
ToUpper func(string) string
ToLongDate func(string) string
Modulo func(int, int) int
Plus func(int, int) int

About Index Pages

  1. A sample index page can be found at github

About searches

  1. The search page should send queries using javascript to /search_results
  2. The end result should look like /search_results?s=bank+account
  3. A sample search page can be found at github

About Sitemaps

Sitemaps makes the work easier for search engines.

A sitemap is always generated and can be found at /static/sitemap.xml

Don’t use Nginx or Apache

The projects ships with its own alternative in the folder sites115d. This is the only way to enable search functionality.

The sites115d expects the path to a folder. This folder must be the the out folder described above.