home · contact · privacy
Add interpretation of article-specific linkback URL list files.
[redo-blog] / README.md
1 redo-blog
2 =========
3
4 small blog system using the redo build system, with blog article files written
5 in (pandoc) Markdown or ReStructured Text.
6
7 dependencies
8 ------------
9
10 - redo
11 - python3
12 - uuidgen (Debian package: uuid-runtime)
13 - html2text
14 - pandoc
15
16 testing
17 -------
18
19 Run ./test.sh.
20
21 setup
22 -----
23
24 To set up a directory with symbolic links to the relevant files in ./processor/,
25 run ./add_dir.sh DIRECTORY.
26
27 You can then enter the directory and run redo there. This will generate article
28 .html files from all .md and .rst files, plus a ./index.html, and a ./feed.xml.
29 These files will be linked to symbolically in a directory ./public/. If you
30 provide a file suffixed .links to basename of an article file, these links will
31 be added as article-specific linkbacks to the .html file and the feed entry.
32
33 Some metadata files will also be generated below ./metadata/: For each article,
34 there will be generated a .automatic_metadata (to contain an article's UUID,
35 checksum, and creation/modification dates) and a .intermediate file (to contain
36 pandoc-formatted article content like title and body); furthermore, files for
37 data used in ./feed.xml and ./index.html will, if non-existant, be built there
38 and can be edited to customize the blog – namely the files url, author, title,
39 index.tmpl, index_snippet.tmpl, article.tmpl, linkback.tmpl. A blog-specific
40 UUID and creation date is stored in ./metadata/automatic_metadata
41
42 recipe to remotely manage a redo blog with git
43 ----------------------------------------------
44
45 On your server, install the dependencies listed above. Then set up a repository
46 for your blog files. Let's assume we want it to sit in our home directory and be
47 called `blog`:
48
49     cd ~
50     mkdir blog
51     git init --bare blog.git
52     cat << EOF > blog.git/hooks/post-update
53     #!/bin/sh
54     blog_dir=~/blog
55     export GIT_DIR=\$(pwd)
56     export GIT_WORK_TREE="\$blog_dir"
57     git checkout -f
58     cd "\$GIT_WORK_TREE"
59     redo
60     git add metadata/author metadata/url metadata/title metadata/*.tmpl metadata/automatic_metadata
61     count=\$(ls -1 metadata/*.automatic_metadata 2>/dev/null | wc -l)
62     if [ "\$count" != 0 ]; then
63       git add metadata/*.automatic_metadata
64     fi
65     status=\$(git status -s)
66     n_updates=\$(printf "\$status" | grep -vE '^\?\?' | wc -l)
67     if [ "\$n_updates" -gt 0 ]; then
68       git commit -a -m 'Update metadata'
69     fi
70     EOF
71     chmod a+x blog.git/hooks/post-update
72
73 Enable management of `~/blog` via redo-blog:
74
75     git clone https://github.com/plomlompom/redo-blog/
76     cd redo-blog/
77     ./add_dir.sh ~/blog
78     mkdir ~/blog/public
79
80 Link to the `public` subdirectory from wherever your web server expects your
81 public web content to sit:
82
83     ln -s ~/blog/public /var/www/html/blog
84
85 Client-side, do this (you obviously need to customize this code; at least
86 replace the username `user` and the server name `example.org`):
87
88     cd ~
89     git init blog
90     cd blog
91     git remote add origin ssh://user@example.org:/home/user/blog.git
92     mkdir metadata
93     echo 'https://example.org/blog/' > metadata/url
94     git add metadata/url
95     git commit -m 'set up blog metadata'
96     git push origin master
97
98 If successful, the git hook will furthermore commit some ~/blog/metadata/ files
99 generated by redo, that can be pulled into the client-side local repository:
100
101     git pull origin master
102
103 bugs and peculiarities
104 ----------------------
105
106 Don't create a index.rst or index.md in the redo-managed directory, that will
107 break things.
108
109 The article title is derived in .md files from a first line prefixed with `%`,
110 while all other headings are treated as sub-headings. In .rst files, the title
111 is derived from a heading that must be at the top of the document, and be of an
112 adornment style (such as underlining with `=`) used only once in it.
113
114 Symbolic links in public/ to removed article pages are currently not removed.