]> git.r.bdr.sh - rbdr/blog/blame - README.md
Add self link
[rbdr/blog] / README.md
CommitLineData
4ae55e06 1# blog
7a5a585e 2
2acbdb03 3Blog at unlimited.pizza -> Only 3 at a time.
fac54389
RBR
4
5The blog is no longer 100% ephemeral. Instead it now keeps an archive
6in a separate folder. The archive is intended to be used as a gemlog.
7a5a585e
BB
7
8## How to install
9
10`npm install -g .` will expose the `blog` binary to your CLI.
11
12## How to add a new entry
13
2acbdb03 14Create a `.gmi` gemini file.
7a5a585e
BB
15
16You can add this to the blog using the following command, it will shift
17all entries and remove the oldest one if limit of posts is reached
18(defualts to 3):
19
2acbdb03
RBR
20```
21blog --add path/to/blog_post.gmi
22```
7a5a585e
BB
23
24These commands will regenerate the static files. At that point you can
d92ac8cc 25preview your blog by serving the files on the `static` directory.
7a5a585e
BB
26
27If you need to make corrections use:
28
2acbdb03
RBR
29```
30blog --update path/to/blog_post.gmi
31```
7a5a585e
BB
32
33This will replace the latest with the contents of the `path` without
34shifting the existing entries.
35
2acbdb03 36You can always regenerate the static files by using
fac54389 37
2acbdb03
RBR
38```
39blog --generate
40```
41
42To publish the blog, you can select an s3 bucket and run it with:
43
44```
45blog --publish <bucket>
46```
47
48You can also publish the archive of posts as a gemlog, by passing a valid
49rsync target
50
51```
52blog --publish-archive <rsync_target>
53```
54
55Blog supports saving snapshots of the blog in git, and you can add and remove
56remotes with the following commands:
57
58```
59blog --add-remote <git_url>
60blog --remove-remote
61```
62
63If a remote is present, it will be pulled before adding or updating, and pushed
64after it finishes. You can manually trigger this by calling
65
66```
67blog --sync-up
68blog --sync-down
69```
fac54389
RBR
70
71## Configuring
72
73### Overriding Number of Posts
74
75Updating the `BLOG_MAX_POSTS` environment variable sets the number of posts
76that will be kept.
77
78### Overriding Templates
79
80You can set the `BLOG_TEMPLATES_DIRECTORY` to any directory you want.
81The tool will expect a `feed.xml`, `index.html`, and `index.txt` files.
82
83These templates are then parsed with [dot][dot] and exposes the following
84variables:
85
86```
87it.posts: <Array[Post]>
88
89Post
90 +id: String // The numerical timestamp when the blog post was added.
91 +createdOn: String // The UTC String of post creation date. (only feed.xml)
92 +title: String // The title of the post. (only feed.xml)
93 +raw: String // The raw gemini text of the template.
94 +html: String // The parsed html generated from the gemini.
95```
96
97The default is the `templates` directory inside the root of the `blog`
98module directory.
99
100### Overriding the location of posts.
101
102Setting `BLOG_POSTS_DIRECTORY` will update where the posts are saved when
103added. The default is the `.posts` directory inside the root of the
104`blog` module directory.
105
106### Overriding the location of static files.
107
108Setting `BLOG_STATIC_DIRECTORY` will update where static files are read
109from. This is also where the generated blog will be placed.
110
111The default is the `static` directory inside the root of the `blog` module
112directory.
7a5a585e 113
fac54389
RBR
114This directory should also contain files referenced in the templates, like
115`css`, `js` or `images`.
39744467
BB
116
117## How to publish
118
fac54389
RBR
119The publishing method is extremely naive. It assumes you have the
120AWS CLI installed and configured. It will attempt to sync the static
121directory to the bucket.
122
123## The archive
124
125The archive directory will have a full archive of the posts (currently
126as a gemlog format).
127
128This gets updated every time you add or update a post.
129
65d379f5
RBR
130Publishing with `--publish` will not publish the archive. Instead you should
131use `--publish-archive`, which will `rsync` it to the destination provided.
39744467 132
d92ac8cc
BB
133## Debugging
134
135If you want to know more about what's going on when blog generates
136data, set the environment variable `NODE_DEBUG=blog`. This will
137enable the debug messages
138
fac54389 139[dot]: https://olado.github.io/doT/