iREADME.md - cl-yag - Common Lisp Yet Another website Generator Err bitreich.org 70 hgit clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/ URL:git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/ bitreich.org 70 1Log /scm/cl-yag/log.gph bitreich.org 70 1Files /scm/cl-yag/files.gph bitreich.org 70 1Refs /scm/cl-yag/refs.gph bitreich.org 70 1Tags /scm/cl-yag/tag bitreich.org 70 1README /scm/cl-yag/file/README.md.gph bitreich.org 70 1LICENSE /scm/cl-yag/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 iREADME.md (9936B) Err bitreich.org 70 i--- Err bitreich.org 70 i 1 # README Err bitreich.org 70 i 2 Err bitreich.org 70 i 3 Err bitreich.org 70 i 4 ## Introduction Err bitreich.org 70 i 5 Err bitreich.org 70 i 6 cl-yag is a lightweight, static site generator that produces Err bitreich.org 70 i 7 **gopher** sites as well as **html** websites. The name 'cl-yag' Err bitreich.org 70 i 8 stands for 'Common Lisp - Yet Another website Generator'. It runs Err bitreich.org 70 i 9 without needing Quicklisp (Common LISP library manager). Err bitreich.org 70 i 10 Err bitreich.org 70 i 11 Err bitreich.org 70 i 12 ## Showcase Err bitreich.org 70 i 13 Err bitreich.org 70 i 14 I am using cl-yag to create and maintain my websites in the Err bitreich.org 70 i 15 world-wide-web (visit: *[Solene's percent] Err bitreich.org 70 i 16 (https://dataswamp.org/~solene/)*) as well as [in gopher-space] Err bitreich.org 70 i 17 (gopher://dataswamp.org/1/~solene/). Err bitreich.org 70 i 18 Err bitreich.org 70 i 19 Err bitreich.org 70 i 20 ## Requirements Err bitreich.org 70 i 21 Err bitreich.org 70 i 22 To use cl-yag you'll need: Err bitreich.org 70 i 23 Err bitreich.org 70 i 24 1. A Common Lisp Interpreter Err bitreich.org 70 i 25 - cl-yag's current default is [Steel Bank Common Lisp (SBCL)](http://www.sbcl.org/). Err bitreich.org 70 i 26 - [Embeddable Common Lisp (ECL)](https://common-lisp.net/project/ecl/) will do fine as well. Err bitreich.org 70 i 27 2. A Markdown-to-HTML Converter Err bitreich.org 70 i 28 - cl-yag's current default is [multimarkdown](http://fletcherpenney.net/multimarkdown/). Err bitreich.org 70 i 29 Err bitreich.org 70 i 30 Err bitreich.org 70 i 31 ## Usage Err bitreich.org 70 i 32 Err bitreich.org 70 i 33 Go into your project's directory and type ``make``. You'll find your new website/gopher page in **output/**. Err bitreich.org 70 i 34 If you want to get rid of everything in your **output/** sub directories, type ``make clean``. Err bitreich.org 70 i 35 For further commands: read the Makefile. Err bitreich.org 70 i 36 Read in the following section where to find it. Err bitreich.org 70 i 37 Err bitreich.org 70 i 38 Err bitreich.org 70 i 39 ## Overview: cl-yag's File Hierarchy Err bitreich.org 70 i 40 Err bitreich.org 70 i 41 After cloning the repository, your project's directory should contain at Err bitreich.org 70 i 42 least the following files and folders: Err bitreich.org 70 i 43 Err bitreich.org 70 i 44 . Err bitreich.org 70 i 45 |-- LICENSE Err bitreich.org 70 i 46 |-- Makefile Err bitreich.org 70 i 47 |-- README.md Err bitreich.org 70 i 48 |-- data/ Err bitreich.org 70 i 49 | |-- 1.md Err bitreich.org 70 i 50 | |-- README.md Err bitreich.org 70 i 51 | `-- articles.lisp Err bitreich.org 70 i 52 |-- generator.lisp Err bitreich.org 70 i 53 |-- output/ Err bitreich.org 70 i 54 | |-- gopher/ Err bitreich.org 70 i 55 | `-- html/ Err bitreich.org 70 i 56 |-- static/ Err bitreich.org 70 i 57 | |-- css/style.css Err bitreich.org 70 i 58 | `-- img/ Err bitreich.org 70 i 59 `-- templates/ Err bitreich.org 70 i 60 |-- article.tpl Err bitreich.org 70 i 61 |-- gopher_head.tpl Err bitreich.org 70 i 62 |-- layout.tpl Err bitreich.org 70 i 63 |-- one-tag.tpl Err bitreich.org 70 i 64 |-- rss-item.tpl Err bitreich.org 70 i 65 `-- rss.tpl Err bitreich.org 70 i 66 Err bitreich.org 70 i 67 - **Makefile** Err bitreich.org 70 i 68 - This file exists to simplify the recurring execution of frequently used commands. Err bitreich.org 70 i 69 - **generator.lisp** Err bitreich.org 70 i 70 - This is cl-yag's core library. Err bitreich.org 70 i 71 - **static/** Err bitreich.org 70 i 72 - This directory holds content, that needs to be published without being changed (e.g. style sheets, js-scripts). Err bitreich.org 70 i 73 - If you come from 'non-static CMS'-Country: **static/** holds, what you would put in your **assets/** directory. Err bitreich.org 70 i 74 - **templates/** Err bitreich.org 70 i 75 - The templates in this directory provide the structural skeleton(s) of the web pages and feeds you want to create. Err bitreich.org 70 i 76 - **output/** Err bitreich.org 70 i 77 - cl-yag puts in this directory everything ready to get deployed. Err bitreich.org 70 i 78 - Because cl-yag generates not only HTML, but gopher-compliant pages as well, **output/** **holds two sub directories**. Err bitreich.org 70 i 79 - **gopher/** contains the website for gopher, Err bitreich.org 70 i 80 - **html/** contains the website in HTML. Err bitreich.org 70 i 81 Err bitreich.org 70 i 82 And there is the **data/** directory, which is important enough to get a subsubsection of its own. Err bitreich.org 70 i 83 Err bitreich.org 70 i 84 ### The data/ Directory Err bitreich.org 70 i 85 Err bitreich.org 70 i 86 This directory is crucial for the usage of cl-yag. Err bitreich.org 70 i 87 Err bitreich.org 70 i 88 **data/** contains Err bitreich.org 70 i 89 Err bitreich.org 70 i 90 - the **articles.lisp** configuration file, which defines important meta-data for posts and pages. Err bitreich.org 70 i 91 - It also holds **${id}.md** files, which are holding your posts' (or pages') content. You can use markdown to write them. Err bitreich.org 70 i 92 Err bitreich.org 70 i 93 For more information: Read section 'Configuration'. Err bitreich.org 70 i 94 Err bitreich.org 70 i 95 Err bitreich.org 70 i 96 ## Configuration Err bitreich.org 70 i 97 Err bitreich.org 70 i 98 cl-yag's main configuration file is **data/articles.lisp**. Err bitreich.org 70 i 99 In order to have a running implementation of cl-yag, you have Err bitreich.org 70 i 100 to set most of the values in this file. Err bitreich.org 70 i 101 Err bitreich.org 70 i 102 **data/articles.lisp** has two parts: Err bitreich.org 70 i 103 Err bitreich.org 70 i 104 1. A variable called *config*. Its values define your web page. Err bitreich.org 70 i 105 2. "posts" declaration with their meta-data Err bitreich.org 70 i 106 Err bitreich.org 70 i 107 Values are assigned by placing a string (e.g. ``"foo"``) or a boolean Err bitreich.org 70 i 108 (i.e. ``t`` or ``nil``) behind a keyword (e.g. ``:title``). Err bitreich.org 70 i 109 Err bitreich.org 70 i 110 Err bitreich.org 70 i 111 ### The *config* Variable Err bitreich.org 70 i 112 Err bitreich.org 70 i 113 The *config* variable is used to assign the following values: Err bitreich.org 70 i 114 Err bitreich.org 70 i 115 - **:webmaster** Err bitreich.org 70 i 116 - The name of the default(!) author. Err bitreich.org 70 i 117 - ``:webmaster`` gets used, if ``:author`` is omitted. (See below: 'The **articles** variable'.) Err bitreich.org 70 i 118 - **:title** Err bitreich.org 70 i 119 - The title of the web-page Err bitreich.org 70 i 120 - **:description** Err bitreich.org 70 i 121 - This text is used in the *description* field of the atom/rss feed. Err bitreich.org 70 i 122 - **:url** Err bitreich.org 70 i 123 - This needs to be the full(!) URL of your website, including(!) a final slash. Err bitreich.org 70 i 124 - MIND: If the url contains a tilde (~), it needs to get duplicated. Err bitreich.org 70 i 125 - Example: ``https://mydomain/~~user/`` Err bitreich.org 70 i 126 - **:rss-item-number** Err bitreich.org 70 i 127 - This holds the number of latest(!) RSS items you want to get published. Err bitreich.org 70 i 128 - **html** Err bitreich.org 70 i 129 - ``t`` to export html website. Set ``nil`` to disable. Err bitreich.org 70 i 130 - **gopher** Err bitreich.org 70 i 131 - ``t`` to export gopher website. Set ``nil`` to disable. Err bitreich.org 70 i 132 - **gopher-path** Err bitreich.org 70 i 133 - This is the full path of the directory to access your gopher hole. Err bitreich.org 70 i 134 - **gopher-server** Err bitreich.org 70 i 135 - Hostname of the gopher server. It needs to be included in each link. Err bitreich.org 70 i 136 - **gopher-port** Err bitreich.org 70 i 137 - tcp port of the gopher server. 70 is the default port. It needs to be included in each link. Err bitreich.org 70 i 138 - **gopher-format** Err bitreich.org 70 i 139 - format of the gopher server. default is the geomyidae format, gophernicus format is commented. Err bitreich.org 70 i 140 - **gopher-index** Err bitreich.org 70 i 141 - name of the gopher menu file. default is index.gph for geomyidae, gophermap file is commented. Err bitreich.org 70 i 142 Err bitreich.org 70 i 143 Err bitreich.org 70 i 144 ### Posts declarations Err bitreich.org 70 i 145 Err bitreich.org 70 i 146 Each post is declared with its meta-data using the function "post". Err bitreich.org 70 i 147 So you need to add a new line for each of your posts. Err bitreich.org 70 i 148 Err bitreich.org 70 i 149 Of the following keywords, only ``:author`` and ``:short`` can be omitted. Err bitreich.org 70 i 150 Err bitreich.org 70 i 151 - **:author** Err bitreich.org 70 i 152 - The ``:author`` field is used to display the article's author. Err bitreich.org 70 i 153 - If you omit it, the generator will take the name from the ``:webmaster`` field of the *config* variable. Err bitreich.org 70 i 154 - **:id** Err bitreich.org 70 i 155 - The ``:id`` field holds the file name of your post/page. Err bitreich.org 70 i 156 - Example: ``:id "2"`` will load file **data/2.md**. Use text instead of numbers, if you want to. Err bitreich.org 70 i 157 - (See section: 'The **data/** Directory'.) Err bitreich.org 70 i 158 - **:tag** Err bitreich.org 70 i 159 - ``:tag`` field is used to create a "view" containing all articles of the same tag. Err bitreich.org 70 i 160 - MIND: White spaces are used to separate tags and are not allowed in(!) tags. Err bitreich.org 70 i 161 - **:tiny** Err bitreich.org 70 i 162 - The ``:tiny`` field's value is used for displaying a really short description of the posts content on your homepage. Err bitreich.org 70 i 163 - If ``:tiny`` doesn't get a value, the full article gets displayed. Err bitreich.org 70 i 164 - Hint: Use ``:tiny "Read the full article for more information."``, if you don't want to display the full text of an article on your index site. Err bitreich.org 70 i 165 - **:title** Err bitreich.org 70 i 166 - The ``:title`` field's value sets your post's title, its first headline, as well as its entry on the index.html. Err bitreich.org 70 i 167 Err bitreich.org 70 i 168 Err bitreich.org 70 i 169 ## How-to Create A New Post Err bitreich.org 70 i 170 Err bitreich.org 70 i 171 Edit **data/articles.lisp** and add a new list to the *articles* variable: Err bitreich.org 70 i 172 Err bitreich.org 70 i 173 (list :title "How do I use cl-yag" Err bitreich.org 70 i 174 :id "2" Err bitreich.org 70 i 175 :date "29 April 2016" Err bitreich.org 70 i 176 :author "Solène" Err bitreich.org 70 i 177 :tiny "Read more about how I use cl-yag." Err bitreich.org 70 i 178 :tag "example help code") Err bitreich.org 70 i 179 Err bitreich.org 70 i 180 Then write a corresponding **data/2.md** file, using markdown. Err bitreich.org 70 i 181 Err bitreich.org 70 i 182 Err bitreich.org 70 i 183 ## How-to Publish A Post Err bitreich.org 70 i 184 Err bitreich.org 70 i 185 I prepared a Makefile to facilitate the process of generating and Err bitreich.org 70 i 186 publishing your static sites. Err bitreich.org 70 i 187 All you need to do in order to publish is to go into your cl-yag Err bitreich.org 70 i 188 directory and type ``make``. Err bitreich.org 70 i 189 Err bitreich.org 70 i 190 The make command creates html and gopher files in the defined location. Err bitreich.org 70 i 191 The default is the **output/** directory, but you can use a symbolic link Err bitreich.org 70 i 192 pointing to some other directory as well. Err bitreich.org 70 i 193 Err bitreich.org 70 i 194 Err bitreich.org 70 i 195 ## How-to Add A New Page Err bitreich.org 70 i 196 Err bitreich.org 70 i 197 You may want to have some dedicated pages besides the index or a post. Err bitreich.org 70 i 198 To create one, edit the *generate-site* function in cl-yag's Err bitreich.org 70 i 199 **generator.lisp** and add a function call, like this: Err bitreich.org 70 i 200 Err bitreich.org 70 i 201 (generate "somepage.html" (load-file "data/mypage.html")) Err bitreich.org 70 i 202 Err bitreich.org 70 i 203 This will produce **output/html/somepage.html**. Err bitreich.org 70 i 204 Err bitreich.org 70 i 205 Err bitreich.org 70 i 206 ## Further Customization Err bitreich.org 70 i 207 Err bitreich.org 70 i 208 ### How-to Use Another Common Lisp Interpreter Err bitreich.org 70 i 209 Err bitreich.org 70 i 210 cl-yags default Lisp interpreter is **sbcl**. If you want to use a Err bitreich.org 70 i 211 different interpreter you need to set the variable *LISP* to the name Err bitreich.org 70 i 212 of your binary, when calling ``make``: Err bitreich.org 70 i 213 Err bitreich.org 70 i 214 make LISP=ecl Err bitreich.org 70 i 215 Err bitreich.org 70 i 216 Err bitreich.org 70 i 217 ### Using git Hooks For Publishing Err bitreich.org 70 i 218 Err bitreich.org 70 i 219 You may customize your publishing-process further, e.g. by using a git Err bitreich.org 70 i 220 hook to call the make program after each change in the repo so your Err bitreich.org 70 i 221 website gets updated automatically. Err bitreich.org 70 i 222 Err bitreich.org 70 i 223 Err bitreich.org 70 i 224 ## Page-Includes Err bitreich.org 70 i 225 Err bitreich.org 70 i 226 Here is an example code, if you want to include another page in the template: Err bitreich.org 70 i 227 Err bitreich.org 70 i 228 1. Create **templates/panel.tpl** containing the html you want to include. Err bitreich.org 70 i 229 2. Add a replacement-string in the target file, where the replacement should occur. Err bitreich.org 70 i 230 In this case, we choose **%%Panel%%** for a string, and, because we want the panel to be displayed on each page, we add this string to **templates/layout.tpl**. Err bitreich.org 70 i 231 Err bitreich.org 70 i 232 3. Modify the function *generate-layout* in cl-yag's **generator.lisp** accordingly. Err bitreich.org 70 i 233 This is done by adding the following template function call: Err bitreich.org 70 i 234 Err bitreich.org 70 i 235 (template "%%Panel%%" (load-file "templates/panel.tpl")) Err bitreich.org 70 i 236 Err bitreich.org 70 i 237 Another valid approach is to writer your html directly into **templates/layout.tpl**. Err bitreich.org 70 i 238 Err bitreich.org 70 i 239 ## Known Limitations Err bitreich.org 70 i 240 Err bitreich.org 70 i 241 ### Use ~~ To Create ~ Err bitreich.org 70 i 242 Err bitreich.org 70 i 243 cl-yag crashes if you use a single "~" character inside Err bitreich.org 70 i 244 **templates/articles.lisp**, because Common Lisp employs the tilde as a Err bitreich.org 70 i 245 prefix to indicate format specifiers in format strings. Err bitreich.org 70 i 246 Err bitreich.org 70 i 247 In order to use a literal `~` -- e.g. for creating a ``:title`` or Err bitreich.org 70 i 248 ``:url`` reference -- you have to *escape* the tilde *by Err bitreich.org 70 i 249 duplicating* it: ``~~``. (See ``:url`` in section 'Configuration'). Err bitreich.org 70 i 250 Err bitreich.org 70 i 251 Err bitreich.org 70 i 252 ### Posting Without Tagging Err bitreich.org 70 i 253 Err bitreich.org 70 i 254 cl-yag allows posts without tags, but, using the default Err bitreich.org 70 i 255 **templates/layout.tpl**, you'll get a line below your title that Err bitreich.org 70 i 256 displays: "Tags: ". Err bitreich.org 70 i 257 Err bitreich.org 70 i 258 (Note: If you are looking for a way to contribute this may be a task for you.) Err bitreich.org 70 i 259 Err bitreich.org 70 i 260 Err bitreich.org 70 i 261 ### A Note On Themes Err bitreich.org 70 i 262 Err bitreich.org 70 i 263 Although cl-yag may ship with a minimalist template, cl-yag focuses Err bitreich.org 70 i 264 on generating html- and gopher-compliant structural markup - not Err bitreich.org 70 i 265 themed layouts. Err bitreich.org 70 i 266 Err bitreich.org 70 i 267 If you want some deeply refined, cross-browser compatible, responsive, Err bitreich.org 70 i 268 webscale style sheets, you need to create them yourself. However, Err bitreich.org 70 i 269 cl-yag will work nicely with them and if you want to make your Err bitreich.org 70 i 270 style sheets a part of cl-yag you're very welcome to contact me. Err bitreich.org 70 i 271 Err bitreich.org 70 i 272 Err bitreich.org 70 i 273 # Hacking cl-yag Err bitreich.org 70 i 274 Err bitreich.org 70 i 275 I tried to make cl-yag easy to extend. Err bitreich.org 70 i 276 If you want to contribute, feel free to contact me and/or to send in a patch. Err bitreich.org 70 i 277 Err bitreich.org 70 i 278 - If you are looking for a way to contribute: Err bitreich.org 70 i 279 - You could find a way to "sanitize" cl-yag's behaviour regarding the tilde (see: above); Err bitreich.org 70 i 280 - Also see: 'Note' in 'Posting Without Tagging'; Err bitreich.org 70 i 281 - Also see: 'A Note On Themes'. Err bitreich.org 70 .