2024-02-16 19:29:43 +01:00
# jorge
2024-02-20 01:58:52 +01:00
A personal (small + opinionated) site generator with [org-mode ](https://orgmode.org/ ) (and markdown) support.
2024-02-13 18:58:07 +01:00
2024-02-20 01:58:52 +01:00
## Installation
Download the [latest release binary ](https://github.com/facundoolano/jorge/releases/latest ) for your platform, for example:
2024-02-13 18:58:07 +01:00
2024-02-20 01:58:52 +01:00
$ wget https://github.com/facundoolano/jorge/releases/latest/download/jorge-darwin-amd64 \
-O jorge & & chmod +x jorge & & mv jorge /usr/local/bin
2024-02-13 18:58:07 +01:00
2024-02-20 01:58:52 +01:00
Alternatively, install with go:
2024-02-13 18:58:07 +01:00
2024-02-20 01:58:52 +01:00
$ go install github.com/facundoolano/jorge@latest
2024-02-13 18:58:07 +01:00
2024-02-21 18:32:03 +01:00
## Example usage
Create a new website with `jorge init` :
2024-02-13 18:58:07 +01:00
2024-02-16 16:54:31 +01:00
```bash
2024-02-16 19:29:43 +01:00
$ jorge init myblog
2024-02-21 18:32:03 +01:00
site name: My Blog
site url: https://myblog.olano.dev
author: Facundo Olano
added myblog/.gitignore
added myblog/includes/post_preview.html
added myblog/layouts/base.html
added myblog/layouts/default.html
added myblog/layouts/post.html
added myblog/src/assets/css/main.css
added myblog/src/blog/goodbye-markdown.md
added myblog/src/blog/hello-org.org
added myblog/src/blog/index.html
added myblog/src/blog/tags.html
added myblog/src/feed.xml
added myblog/src/index.html
```
This initializes a new project with default configuration, styles and layouts, and a couple of sample posts.
(You can, of course, use a different site structure or just skip the init command altogether).
To preview your site locally, use `jorge serve` :
2024-02-16 16:54:31 +01:00
2024-02-21 18:32:03 +01:00
```bash
2024-02-13 18:58:07 +01:00
$ cd myblog
2024-02-21 18:32:03 +01:00
$ jorge serve
wrote target/feed.xml
wrote target/blog/goodbye-markdown.html
wrote target/blog/my-first-post.html
wrote target/blog/hello-org.html
wrote target/blog/index.html
wrote target/index.html
wrote target/blog/tags.html
2024-02-21 22:41:03 +01:00
serving at http://localhost:4001
2024-02-21 18:32:03 +01:00
```
The site is renders the files found at `src/` in the `target/` directory.
You can add new pages by just adding files to `src/` but, for the common case of adding blog posts,
the `jorge post` creates files with the proper defaults:
```
2024-02-16 19:29:43 +01:00
$ jorge post "My First Post"
2024-02-21 18:32:03 +01:00
added src/blog/my-first-post.org
$ cat src/blog/my-first-post.org
---
title: My First Post
date: 2024-02-21 13:39:59
layout: post
lang: en
tags: []
2024-02-27 16:24:45 +01:00
draft: true
2024-02-21 18:32:03 +01:00
---
#+OPTIONS: toc:nil num:nil
#+LANGUAGE: en
```
2024-02-16 16:54:31 +01:00
2024-02-21 18:32:03 +01:00
(Posts are created as .org files by default, but you can chage it to prefer markdown or another text format).
2024-02-16 16:54:31 +01:00
2024-02-21 18:32:03 +01:00
If you still have `jorge serve` running, you can see the new post by browsing to `http://localhost:4001/blog/my-first-post` . You can then add some content and the browser tab will automatically refresh to reflect your changes:
2024-02-16 16:54:31 +01:00
2024-02-21 18:32:03 +01:00
```bash
$ cat >> src/blog/my-first-post.org < < EOF
2024-02-20 22:20:13 +01:00
*** Hello world!
2024-02-13 18:58:07 +01:00
2024-02-16 16:56:46 +01:00
this is my *first* post.
EOF
2024-02-21 18:32:03 +01:00
```
2024-02-16 16:54:31 +01:00
2024-02-27 16:24:45 +01:00
Posts created with `jorge post` are drafts by default. Remove the `draft: true` to mark it ready for publication:
``` bash
$ sed -i '' '/^draft: true$/d' src/blog/my-first-post.org
```
2024-02-21 18:32:03 +01:00
Finally, you can render a minified version of your site with `jorge build` :
2024-02-16 16:54:31 +01:00
2024-02-21 18:32:03 +01:00
```
2024-02-16 19:29:43 +01:00
$ jorge build
2024-02-16 16:54:31 +01:00
wrote target/index.html
wrote target/assets/css/main.css
wrote target/blog/hello.html
wrote target/blog/my-first-post.html
wrote target/feed.xml
wrote target/tags.html
2024-02-13 18:58:07 +01:00
```
2024-02-21 18:32:03 +01:00
And that's about it. For more details see the:
2024-02-13 18:58:07 +01:00
2024-02-16 19:29:43 +01:00
- [Tutorial ](https://jorge.olano.dev#tutorial )
2024-02-23 17:39:11 +01:00
- [Development blog ](https://jorge.olano.dev#devlog )
2024-02-21 18:32:03 +01:00
## Acknowledgements
jorge started as a Go learning project and was largely inspired by [Jekyll ](https://jekyllrb.com/ ). Most of the heavy lifting is done by external libraries:
* [osteele/liquid ](https://github.com/osteele/liquid ) to render liquid templates. Some Jekyll-specific filters were copied from [osteele/gojekyll ](https://github.com/osteele/gojekyll/ ).
* [niklasfasching/go-org ](https://github.com/niklasfasching/go-org ) to render org-mode files as HTML.
* [yuin/goldmark ](https://github.com/yuin/goldmark ) to render Markdown as HTML.
* [go-yaml ](https://github.com/go-yaml/yaml ) to parse YAML files and template headers.
* [tdewolff/minify ](https://github.com/tdewolff/minify ) to minify HTML, CSS, XML and JavaScript files.