Added a section on templating within themes

This commit is contained in:
William Duyck 2013-07-21 02:19:51 +01:00
parent a0c6fd5d1c
commit fe526e9862

View file

@ -87,7 +87,10 @@
<ul><li><a href="#text-file-markup">Text File Markup</a></li></ul>
</li>
<li><a href="#themeing">Themeing</a>
<ul><li><a href="#blogging">Blogging</a></li></ul>
<ul>
<li><a href="#templating">Templating</a></li>
<li><a href="#blogging">Blogging</a></li>
</ul>
</li>
<li><a href="#plugins">Plugins</a></li>
<li><a href="#contribute">Contribute</a></li>
@ -150,11 +153,12 @@
They can also contain regular HTML. At the top of text files you can place a block comment and specify certain attributes of the page.
For example:</p>
<pre><code>/*
Title: Welcome
Description: This description will go in the meta description tag
Author: Joe Bloggs
Date: 2013/01/01
Robots: noindex,nofollow
Title: Welcome
Description: This description will go in the meta description tag
Author: Joe Bloggs
Date: 2013/01/01
Template: index
Robots: noindex,nofollow
*/
</code></pre>
<p>These values will be contained in the <code>{{ meta }}</code> variable in themes (see below).
@ -182,6 +186,7 @@ Robots: noindex,nofollow
<li><code>{{ meta.author }}</code></li>
<li><code>{{ meta.date }}</code></li>
<li><code>{{ meta.date_formatted }}</code></li>
<li><code>{{ meta.template }}</code></li>
<li><code>{{ meta.robots }}</code></li>
</ul></li>
<li><code>{{ content }}</code> - The content of the current page (after it has been processed through Markdown)</li>
@ -206,6 +211,12 @@ Robots: noindex,nofollow
&lt;li&gt;&lt;a href="{{ page.url }}"&gt;{{ page.title }}&lt;/a&gt;&lt;/li&gt;
{% endfor %}
&lt;/ul&gt;</pre>
<h4 id="templating">Templating</h4>
<p>Sometimes we don't want to use the same page layout, but want to stay in theme. To use a different template for a page you can define a template in your pages meta data like so:</p>
<pre><code>/*
Template: template_name
*/</code></pre>
<p>A templates name is the same as the template file in your theme (minus the .html extension). If the template does not exist within you current theme, Pico will default to the themes index.html template.</p>
<h4 id="blogging">Blogging</h4>
<p>If you would like to add a blog to your Pico site we suggest taking the following steps:</p>
<ul>