You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Tunnel CMS is the simplest markdown CMS. It parses markdown files and outputs html in real time whenever necessary. However, not every request requires parsing, as Tunnel CMS builds the HTML files and store in cache. Until, the underlying content of the markdown files is changes, the cached HTML is served.</p>
13
+
<h2>🛠️ Installation</h2>
14
+
<p>Download the <code>tunnel</code> folder along with the <code>.htaccess</code> file from the <ahref="https://github.com/ReactiveMatter/tunnelcms">Github directory</a><code>https://github.com/ReactiveMatter/tunnelcms</code>. Place them in the root of your website, and that's it!</p>
15
+
<p>Tunnel CMS will render your markdown files dynamically, so that you can focus on writing.</p>
16
+
<h2>📝 YAML frontmatter</h2>
17
+
<p>Tunnel CMS parses YAML front matter from the markdown files and serializes them in the <code>$page</code> variable. This can be used by the layout to display content.</p>
18
+
<p>Some useful page properties:</p>
19
+
<table>
20
+
<thead>
21
+
<tr>
22
+
<th>Property</th>
23
+
<th>Description</th>
24
+
</tr>
25
+
</thead>
26
+
<tbody>
27
+
<tr>
28
+
<td><code>layout</code></td>
29
+
<td>Sets the layout for the file which will be used for rendering HTML.</td>
30
+
</tr>
31
+
<tr>
32
+
<td><code>tags</code></td>
33
+
<td>Tags for the file</td>
34
+
</tr>
35
+
</tbody>
36
+
</table>
37
+
<h2>🖥️ Layout</h2>
38
+
<p>The layout files from <code>tunnel/layout</code> folder are used to render html content. The layout can be set in YAML front matter in <code>layout</code> property. <code>default.php</code> is used when no layout is set.</p>
39
+
<p>The <code>title</code> property can be set for the page title. If not set, the first heading in the markdown file is set as title.</p>
40
+
<p>If a layout requires the list of all parsed files, the function <code>get_all_pages()</code> can be called. It returns an array of pages. Each element will have properties set for that page.</p>
41
+
<h2>🏷️ Tags</h2>
42
+
<p>Files can be assigned tags using the front matter property <code>tags</code>. In addition to this, Tunnel CMS assigns tags if hash tags are given in the file (e.g. <code>#tag1</code>).</p>
43
+
<h2>💾 Cache</h2>
44
+
<p>Tunnel CMS stores the rendered HTML files in <code>tunnel/site</code> folder with the directory structure as the root folder. Whenever a file is requested for the first time, a build processes in initiated. In the build process, front matter is processed, the HTML content is generated and saved as HTML files in <code>tunnel/site</code>. The file modified time (mtime) and the build time (btime) is entered into an SQLite database (<code>tunnel/build.db</code>). If the file modified time does not change, the files from <code>tunnel/site</code> are served on request. As and when the file modified time changes, the build process is again initiated.</p>
45
+
<p>The build process can be forced by supplying the <code>?build</code> parameter in the request. No, value is required for this parameter. To build the entire site, <code>?buildsite</code> parameter may be supplied.</p>
46
+
<p>It is suggested to build the entire site whenever any major changes are made to the content. Further, the building of site would be required if template files are changed.</p>
47
+
<p>💡Tip: The cached files can also be used as static site.</p>
48
+
<h2>⚙️ Config</h2>
49
+
<p>Config variable are stored in <code>tunnel/config.php</code>. They are site wide variables used for the build process, and can also be used by the templates.</p>
50
+
<table>
51
+
<thead>
52
+
<tr>
53
+
<th>Config variable</th>
54
+
<th>Description</th>
55
+
</tr>
56
+
</thead>
57
+
<tbody>
58
+
<tr>
59
+
<td><code>$site['title']</code></td>
60
+
<td>Site title</td>
61
+
</tr>
62
+
<tr>
63
+
<td><code>$site['ext']</code></td>
64
+
<td>The file extensions which will be parsed</td>
65
+
</tr>
66
+
<tr>
67
+
<td><code>$site['default-layout']</code></td>
68
+
<td>The default layout for parsing. If set to <code>page</code>, <code>tunnel/layout/page.php</code> will be used.</td>
69
+
</tr>
70
+
<tr>
71
+
<td><code>$site['build-drafts']</code></td>
72
+
<td>Whether to build files tagged as <code>draft</code></td>
73
+
</tr>
74
+
<tr>
75
+
<td><code>$site['default-title']</code></td>
76
+
<td>Default title. Will be used if not title is available in the file.</td>
77
+
</tr>
78
+
<tr>
79
+
<td><code>$site['date-format']</code></td>
80
+
<td>The PHP date display format. To be used in layouts.</td>
81
+
</tr>
82
+
</tbody>
83
+
</table>
84
+
<p>Custom variable can be defined in config file, which can be used in the layout files.</p>
85
+
<h2>📜 Feed</h2>
86
+
<p>If the a feed generating file exists at <code>tunnel/layout/feed.php</code>, it will be called during the <code>buildsite</code> process. The code for generating feeds can be included in this file.</p></div>
0 commit comments