~m15o/nini

nini is the new ni
fix error with anchor
update link regexp
is that the v1? it seems like!

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~m15o/nini
read/write
git@git.sr.ht:~m15o/nini

You can also use your local clone with git send-email.

#nini

nini is a static wiki generator. It generates pages that include backlinks to other pages.

#Installing

With Go installed, you can build from the source with:

go build .

#How to use

nini input output template.htm

Where:

  • input: folder containing all your content, written in .htm
  • output: destination folder that will contain the final built site
  • template.htm: html template file

#Getting started

Now that you've installed nini, let's use it to build a very simple site that talks about coffee. Here's a recommended folder structure, but feel free to change it:

my_coffee_wiki/
├── src/
└── public/

The src folder is where we will add all our pages. We write them in HTML, and use the .htm extension to tell them apart from the generated pages that live in public.

Let's create index.htm in the src folder:

<h1>Coffee</h1>
<p>A popular machine is the <a href="aeropress.html">aeropress<a></p>

As you can see, we've added a link to the aeropress page. However, for this to work, we need to have an aeropress.htm page in the src folder. Let's create it:

<h1>Aeropress</h1>
<p>Created by Alan Adler.</p>

In order to have nini generate our pages in public, we first need to tell it how. For that, we use a template files: template.htm

my_coffee_wiki/
├── src/
│   ├── index.htm
│   └── aeropress.htm
├── public/
└── template.htm

template.htm is the template used to build all our pages. Feel free to make it look good and add CSS. Here's an example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ .Title }}</title>
    <link rel="stylesheet" href="/wiki.css">
    <link rel="alternate" type="application/atom+xml" href="http://m15o.ichi.city/feed.xml" />
</head>
<body>
<nav><a href="home.html">home</a> <a href="journal.html">journal</a> <a href="projects.html">projects</a> <a href="about.html">about</a> <a href="contact.html">contact</a> <a href="/feed.atom">feed</a></nav>
<main>
    {{ .Content }}
    {{ if .Backlinks }}<p><b>backlinks</b>: {{ range .Backlinks }}<a href="{{ .Href }}">{{ .Name }}</a> {{ end }}</p>{{ end }}
</main>
</body>
</html>

Now that we've got everything, we can run:

nini src/ public/ page.htm atom.xml