• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Haskell
  • License
    BSD 3-Clause "New...
  • Created over 7 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Yet another static site generator - non-opinionated, value-level. Less magic == easier to understand

SitePipe

Hey there! If you're just getting started with a static site I'd recommend checking out slick instead. It has better caching support, is faster, and has better pandoc interop! SitePipe isn't deprecated (yet), but I'd recommend trying slick instead! There's a template repo HERE to get you started. Cheers!

Build Status Hackage Join the chat at https://gitter.im/SitePipe/Lobby

SitePipe

Heads up! If you're reading this from the Hackage docs the links will be broken, go read it on Github.

Contents:

What is it?

It's a simple to understand static site generator for making blogs, personal websites, etc.

What's it look like?

Start by setting up the structure of your website in a site folder:

site
β”œβ”€β”€ templates
β”‚Β Β  β”œβ”€β”€ post.html
β”‚Β Β  └── index.html
└── posts
    └── article.md

Here's a dead-simple blog generator using markdown posts, you can see it in action in examples/starter-template, or build on it in the tutorial

{-# language OverloadedStrings #-}
module Main where

import SitePipe

main :: IO ()
main = site $ do
  -- Load all the posts from site/posts/
  posts <- resourceLoader markdownReader ["posts/*.md"]

  -- Build up a context for our index page
  let indexContext :: Value
      indexContext = object [ "posts" .= posts
                            -- The url is where the index page will be written to
                            , "url" .= ("/index.html" :: String)
                            ]

  -- write out index page and posts via templates
  writeTemplate "templates/index.html" [indexContext]
  writeTemplate "templates/post.html" posts

Wait, another static site generator? What about Hakyll/Jekyll?

Yup, yet another static site generator. I've tried using Hakyll and Jekyll on different occasions and found there was too much magic going on with all of the monadic contexts for me to understand how to customize things for my use-cases. Even adding simple tags/categories to my blog seemed far more complex then it needed to be; Hakyll specifically got me really bogged down; what was the Compiler monad? How does an Item work? How do I add a custom field? Why couldn't I just edit data directly like I'm used to doing in Haskell? They seemed a bit too opinionated without giving me escape hatches to wire in my own functionality. If they're working for you, then great! But they weren't working for me, so that's where SitePipe came from.

Getting Started

Quick Start

The easiest way to get started is to clone this repo and try out the examples in the examples directory. There's a starter-template which is a barebones starting point, and also a slightly more complex blog with tags and an rss feed. You can build either of the examples using Stack by cding into the directory and running stack build && stack exec build-site. This creates a 'dist' folder with the results of the build. A quick way to serve the site is to use Serve.

Serving a site with Serve:

Tutorial

Read the walkthrough of the system HERE; it'll run you through the basics of how the system works and how to make your own customizations!

Concepts

How is SitePipe different from other solutions?

Instead of dealing with complex contexts SitePipe works with values. Values are loaded from files and can be rendered into html. What happens to the values in-between is up to you!

SitePipe provides a bunch of helpers for you, but at the end of the day you can fit the pipes together however you like.

Data/Metadata

Metadata for posts and content is parsed from yaml into Aeson's Value type; Aeson can easily represent nested objects or lists inside your metadata, and there's a rich ecosystem for working with Aeson types! You can load resources in as any object which implements FromJSON (or just leave them as Aeson Values) and you have the option to edit the objects directly without worrying about monadic or external context.

Templating

SitePipe has built-in support for Mustache Templates, specifically Justus Adam's implementation in Haskell. This lets you use a well established templating system in your site, complete with template functions, partials, and iteration. Since the underlying data is based on It's clear how templates will behave since resources are based on Aeson's JSON types.

Loaders

You can load resources in to work on them using a Loader, A loader simply finds and loads files into resources by employing a Reader on some files. A basic resourceLoader loader is provided, which will load all of the files matching a set of file-globs through the provided reader and will return an Aeson Value containing the relevant metadata and content. You should be able to use resourceLoader for most things by customizing the reader function which you pass it.

Reader

A reader is a function of the type String -> IO String; the input is the file contents which remain after a yaml header has been stripped off (if it exists). The most common reader is the provided markdownReader which runs a markdown document through pandoc's markdown processor and outputs html. You can write your own readers if you like, either by making a function which operates over the content of the document and matches String -> IO String or by using the provided Pandoc helpers (mkPandocReader, mkPandocReaderWith) which allow you to use any of Pandoc's provided document formats, and optionally specify transformations over the pandoc document before it is rendered to html or some other output format.

Writers

Writers take a list of resources (anything with a ToJSON instance, often an Aeson Value) and will write them to the output where the static site will be. The most common writer is writeTemplate which will render the given resource through a given template, but you can also use textWriter, or write your own writer; either writing to disk using liftIO or by using the provided writeWith combinator which given a transformation from a resource to a String (a -> SiteM String) will write the result of the transformation to the place specified by the resource's url.

Loader/Writers

Some things don't fit into the previous categories. For example copyFiles and copyFilesWith are simple tools which just copy the specified files over as-is into the output directory. You pass either of them a list of file globs and the resulting files will be copied over. copyFiles sends them to the same relative filepath from the source directory to the output directory, while copyFilesWith allows you to transform the filepath to specify a new location for each file.

Utilities

Sitepipe includes a few utilities which simply make working with sites easier. The included utilities will expand as time goes on.

Issues/Troubleshooting

Feel free to file an issue if you run into any trouble, or come ask in the Chatroom

More Repositories

1

rasa

Extremely modular text editor built in Haskell
Haskell
612
star
2

slick

Static site generator built on Shake configured in Haskell
Haskell
204
star
3

void-space

Well-Typed Typing Tutor where you Type Types... in space... yup, you heard me
Haskell
140
star
4

wc

Beating unix `wc` in Haskell
Haskell
136
star
5

lens-regex-pcre

Text lenses using PCRE regexes
Haskell
126
star
6

eve

An extensible event-driven application framework in haskell
Haskell
109
star
7

comonads-by-example

Comonads By Example Conference talk
Haskell
89
star
8

Firefly

Simple Haskell http framework
Haskell
87
star
9

json-to-haskell

In goes JSON, out comes a complete Haskell model complete with instances! CLI and web interface available.
Haskell
83
star
10

astar-monad

A smart A* search monad transformer which supports backtracking user-state!
Haskell
81
star
11

jet

A structural editor for JSON values
Haskell
78
star
12

Advent-Of-Code-Polyglot

Examples of "Advent Of Code" solutions in many programming languages.
Python
72
star
13

mad-props

Forward-propagating Constraint Solver monad. Good for solving Sudoku, N-Queens, etc.
Haskell
66
star
14

lens-csv

Lensy interface for parsing CSV's
Haskell
42
star
15

LumberJack

A terminal-ui log watcher written in Go using the Flux architecture
Go
38
star
16

conway

Conway's game of life in 100 lines or less!
Haskell
34
star
17

tempered

Templating engine based on shell interpolation
Haskell
31
star
18

unipatterns

Helpers which allow safe partial pattern matching in lambdas
Haskell
31
star
19

session-sauce

Shell plugin for managing tmux sessions
Shell
29
star
20

slick-template

A template for quickly building sites with slick
CSS
27
star
21

grids

Arbitrary dimension type-safe grids
Haskell
26
star
22

copy-pasta

Shell
26
star
23

dumbwaiter

Extensible HTTP Web server configured entirely by a yaml file
Haskell
25
star
24

haskell-stack-travis-ci

Dead simple setup tools for running a Haskell build matrix using stack for several versions.
Shell
23
star
25

lens-filesystem

Lens interface for your filesystem
Haskell
22
star
26

selections

Haskell Package for operating with selections over an underlying functor
Haskell
22
star
27

btt-quicknav

HTML overlay for quickly navigating your computer
JavaScript
19
star
28

lens-errors

Handling errors which occur deep inside lens-chains
Haskell
17
star
29

proton

Haskell Profunctor Optics experiments
Haskell
15
star
30

Type-Tac-Toe

Type-safe tic-tac-toe using Typesafe programming in Haskell
Haskell
15
star
31

wave-function-collapse

Wave function collapse procedural generation for arbitrary graphs
Haskell
15
star
32

catalyst

There are many category theory implementations, but this one is mine
Haskell
14
star
33

update-monad

An implementation of the Update Monad and a 'Free' version from https://danelahman.github.io/papers/types13postproc.pdf
Haskell
13
star
34

Candor

A toy Parser+Compiler+Typechecker
Haskell
12
star
35

recursive-zipper

Zippers for cofree types
Haskell
12
star
36

climbing-fp-ladder

A record of examples and anecdotes as I ascend the ladder of Functional Programming
12
star
37

charter

Haskell charting library
Haskell
10
star
38

trek

Haskell
10
star
39

vimprove

A series of daily tasks/info to learn vim from beginner to expert one day at a time.
Shell
9
star
40

react-tui

Haskell
9
star
41

dont-argue

Dead-simple command line arguments for python scripts.
Python
8
star
42

advent-of-code-haskell

Advent of Code Solutions in Haskell
Haskell
7
star
43

BoxKite

A very simple blog framework that emphasizes managing posts in a plain-text directory structure. Runs on Google App Engine, but can also be exported as a static site.
Python
7
star
44

flux-monoid

A monoid which counts changing values in a sequence
Haskell
6
star
45

ffs

A Fuse-compatible Functional File System with @isovector
Haskell
6
star
46

lens-friends

Just some lens combinator experiments :)
Haskell
5
star
47

jaunt

a jq clone in purescript
PureScript
5
star
48

json-to-haskell-web

Haskell
5
star
49

brick-filetree

A brick widget for exploring your filetree
Haskell
5
star
50

vim-committed

Sends Desktop notifications to remind you to commit.
Vim Script
4
star
51

CMPT481

Human Computer Interaction Project
JavaScript
4
star
52

rxjs-tutorial

Walkthrough of building a simple webapp using different rxjs patterns
TypeScript
4
star
53

jsonf

An educational JSON functor library for teaching recursion-schemes
Haskell
4
star
54

haskell-library-template

Template for Haskell libraries
Haskell
4
star
55

rust-advent-of-code

Rust
4
star
56

recursion-schemes-by-example

JavaScript
4
star
57

monad-suspend

Experimental Cost-Annotated Self-Yielding Coroutines
Haskell
4
star
58

game-genre-per-day

Weird and whimsical video game genres everyday!
TypeScript
4
star
59

reactive-streams

Reactive stream combinators in Haskell! Implementations of Rx primitives based on the 'machines' library
Haskell
4
star
60

professor

An experimental http server written entirely with profunctors
Haskell
4
star
61

Wirehack

A small circuit-building game built in Haskell
Haskell
3
star
62

ChrisPenner.github.io

Basic Website
HTML
3
star
63

json-to-haskell-purescript

Generate Haskell datatypes from json objects
Dhall
3
star
64

free-cached

Cache previous runs of free monads
Haskell
3
star
65

substrate

File substitution tools I need for my book
Haskell
3
star
66

cards-against-corona

Elm
3
star
67

chip8

Rust
3
star
68

type-arithmetic

Proofs of types as a semiring via Curry-Howard Isomorphism
Haskell
3
star
69

purescript-node-readline-aff

A wrapper around Node.ReadLine for use with the Aff Monad.
PureScript
3
star
70

Flow

An experimental Haskell FRP (streams) library
Haskell
3
star
71

j-lang-haskell

JLang combinators in Haskell
Haskell
3
star
72

purescript-flow

A redux-style application framework
PureScript
3
star
73

catalyst-build

Experimental build system based on composition of categories & arrows
Haskell
3
star
74

focus

cli utility for hacking and slashing data
Haskell
3
star
75

rx-prop

Propagator based reactive extensions library
Haskell
2
star
76

rsi

Structural regex based command pipelines
Haskell
2
star
77

propellant

Foray into propagator networks in Haskell
Haskell
2
star
78

concurrency-comparison

Comparison of basic concurrency primitives and tasks in Haskell and Golang
Haskell
2
star
79

mustache-shake

Build rules for compiling mustache templates using shake
Haskell
2
star
80

scavenger

A basic texting scavenger hunt using Twilio
Python
2
star
81

mailing-list-reader

Haskell
2
star
82

Kaleidoscope

Working through the Kaleidoscope llvm compiler project
Haskell
2
star
83

delve

Terminal UI File Browser
Haskell
2
star
84

free-contravariant

An exploration into free contravariant functors
Haskell
2
star
85

schemer

Uber basic scheme interpreter
Haskell
2
star
86

continuity

Composable Component Framework
Haskell
2
star
87

eve-cli

Terminal event handlers and rendering for `eve` programs
Haskell
2
star
88

sheets

Overly complex attempt at typesafe spreadsheets
Haskell
2
star
89

Simpleton-Algebraics

Learn about Functional Algebraic Types without making your head explode.
2
star
90

flags

Compiles a declarative bash script configuration into a 100% bash flags and argument parser.
Shell
2
star
91

dual-free

Library for combined free & cofree trees into a single type.
Haskell
2
star
92

cofree-zippers

Just an experiment, move along :)
Haskell
1
star
93

grids-images

Tools for interacting with images using grids
Haskell
1
star
94

overlord

Logs dashboard for all your local servers.
JavaScript
1
star
95

SPA-GAE-template

Single page application template for google app engine using react-redux
JavaScript
1
star
96

SpareSpeare

Shakespeare Filler Text Generator
Python
1
star
97

cmpt317

Python
1
star
98

test-specialization

Companion to a blog post on testing patterns in Haskell
Haskell
1
star
99

reified-dicts

Experiment to reify symbols/nats into constraints by matching them within a known set.
Haskell
1
star
100

unison-testing

Just a scrap unison codebase for testing
1
star