|
@@ -4,23 +4,14 @@ toc:
|
|
|
_title: Creating Content
|
|
|
text-file-markup: Text File Markup
|
|
|
blogging: Blogging
|
|
|
-nav: 2
|
|
|
+nav: 4
|
|
|
---
|
|
|
|
|
|
## Creating Content
|
|
|
|
|
|
-Pico is a flat file CMS, this means there is no administration backend or
|
|
|
-database to deal with. You simply create `.md` files in the `content-sample`
|
|
|
-folder and that becomes a page. For example, this file is called `index.md`
|
|
|
-and is shown as the main landing page.
|
|
|
+Pico is a flat file CMS, this means there is no administration backend or database to deal with. You simply create `.md` files in the `content-sample` folder and that becomes a page. For example, this file is called `index.md` and is shown as the main landing page.
|
|
|
|
|
|
-If you create a folder within the content folder (e.g. `content-sample/sub`)
|
|
|
-and put an `index.md` inside it, you can access that folder at the URL
|
|
|
-`http://yoursite.com/?sub`. If you want another page within the sub folder,
|
|
|
-simply create a text file with the corresponding name and you will be able to
|
|
|
-access it (e.g. `content-sample/sub/page.md` is accessible from the URL
|
|
|
-`http://yoursite.com/?sub/page`). Below we've shown some examples of locations
|
|
|
-and their corresponding URLs:
|
|
|
+If you create a folder within the content folder (e.g. `content-sample/sub`) and put an `index.md` inside it, you can access that folder at the URL `http://example.com/?sub`. If you want another page within the sub folder, simply create a text file with the corresponding name and you will be able to access it (e.g. `content-sample/sub/page.md` is accessible from the URL `http://example.com/?sub/page`). Below we've shown some examples of locations and their corresponding URLs:
|
|
|
|
|
|
<table style="width: 100%; max-width: 40em;">
|
|
|
<thead>
|
|
@@ -53,16 +44,15 @@ and their corresponding URLs:
|
|
|
</tbody>
|
|
|
</table>
|
|
|
|
|
|
-If a file cannot be found, the file `content-sample/404.md` will be shown. You
|
|
|
-can add `404.md` files to any directory, so if you want to use a special error
|
|
|
-page for your blog, simply create `content-sample/blog/404.md`.
|
|
|
+If a file cannot be found, the file `content-sample/404.md` will be shown. You can add `404.md` files to any directory, so if you want to use a special error page for your blog, simply create `content-sample/blog/404.md`.
|
|
|
+
|
|
|
+Instead of adding your own contents to the `content-sample` folder, you should create your own `content` directory in Picos root directory. You can then add and access your contents as described above.
|
|
|
|
|
|
### Text File Markup
|
|
|
|
|
|
-Text files are marked up using [Markdown](https://daringfireball.net/projects/markdown/). They can also contain regular HTML.
|
|
|
+Text files are marked up using [Markdown][]. 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:
|
|
|
+At the top of text files you can place a block comment and specify certain attributes of the page. For example:
|
|
|
|
|
|
<pre><code>---
|
|
|
Title: Welcome
|
|
@@ -73,44 +63,29 @@ Robots: noindex,nofollow
|
|
|
Template: index
|
|
|
---</code></pre>
|
|
|
|
|
|
-These values will be contained in the `{% raw %}{{ meta }}{% endraw %}` variable
|
|
|
-in themes (see below).
|
|
|
+These values will be contained in the `{% raw %}{{ meta }}{% endraw %}` variable in themes (see below).
|
|
|
|
|
|
There are also certain variables that you can use in your text files:
|
|
|
|
|
|
-* <code>%site_title%</code> - The title of your Pico site
|
|
|
-* <code>%base_url%</code> - The URL to your Pico site; internal links
|
|
|
- can be specified using <code>%base_url%?sub/page</code>
|
|
|
-* <code>%theme_url%</code> - The URL to the currently used theme
|
|
|
-* <code>%meta.*%</code> - Access any meta variable of the current page,
|
|
|
- e.g. <code>%meta.author%</code> is replaced with `Joe Bloggs`
|
|
|
+* `%site_title%` - The title of your Pico site
|
|
|
+* `%base_url%` - The URL to your Pico site; internal links can be specified using `%base_url%?sub/page`
|
|
|
+* `%theme_url%` - The URL to the currently used theme
|
|
|
+* `%meta.*%` - Access any meta variable of the current page, e.g. `%meta.author%` is replaced with `Joe Bloggs`
|
|
|
|
|
|
### Blogging
|
|
|
|
|
|
-Pico is not blogging software - but makes it very easy for you to use it as a
|
|
|
-blog. You can find many plugins out there implementing typical blogging
|
|
|
-features like authentication, tagging, pagination and social plugins. See the
|
|
|
-below Plugins section for details.
|
|
|
+Pico is not blogging software - but makes it very easy for you to use it as a blog. You can find many plugins out there implementing typical blogging features like authentication, tagging, pagination and social plugins. See the below Plugins section for details.
|
|
|
|
|
|
-If you want to use Pico as a blogging software, you probably want to do
|
|
|
-something like the following:
|
|
|
+If you want to use Pico as a blogging software, you probably want to do something like the following:
|
|
|
<ol>
|
|
|
<li>
|
|
|
- Put all your blog articles in a separate <code>blog</code> folder in your <code>content</code>
|
|
|
- directory. All these articles should have both a <code>Date</code> and <code>Template</code> meta
|
|
|
- header, the latter with e.g. <code>blog-post</code> as value (see Step 2).
|
|
|
+ Put all your blog articles in a separate <code>blog</code> folder in your <code>content</code> directory. All these articles should have both a <code>Date</code> and <code>Template</code> meta header, the latter with e.g. <code>blog-post</code> as value (see Step 2).
|
|
|
</li>
|
|
|
<li>
|
|
|
- Create a new Twig template called <code>blog-post.twig</code> (this must match the
|
|
|
- <code>Template</code> meta header from Step 1) in your theme directory. This template
|
|
|
- probably isn't very different from your default <code>index.twig</code>, it specifies
|
|
|
- how your article pages will look like.
|
|
|
+ Create a new Twig template called <code>blog-post.twig</code> (this must match the <code>Template</code> meta header from Step 1) in your theme directory. This template probably isn't very different from your default <code>index.twig</code>, it specifies ow your article pages will look like.
|
|
|
</li>
|
|
|
<li>
|
|
|
- Create a <code>blog.md</code> in your <code>content</code> folder and set its <code>Template</code> meta
|
|
|
- header to e.g. <code>blog</code>. Also create a <code>blog.twig</code> in your theme directory.
|
|
|
- This template will show a list of your articles, so you probably want to
|
|
|
- do something like this:
|
|
|
+ Create a <code>blog.md</code> in your <code>content</code> folder and set its <code>Template</code> meta header to e.g. <code>blog</code>. Also create a <code>blog.twig</code> in your theme directory. This template will show a list of your articles, so you probably want to do something like this:
|
|
|
|
|
|
{% raw %}<pre><code>{% for page in pages %}
|
|
|
{% if page.id starts with "blog/" %}
|
|
@@ -123,17 +98,11 @@ something like the following:
|
|
|
{% endfor %}</code></pre>{% endraw %}
|
|
|
</li>
|
|
|
<li>
|
|
|
- Let Pico sort pages by date by setting <code>$config['pages_order_by'] = 'date';</code>
|
|
|
- in your <code>config/config.php</code>. To use a descending order (newest articles
|
|
|
- first), also add <code>$config['pages_order'] = 'desc';</code>. The former won't affect
|
|
|
- pages without a <code>Date</code> meta header, but the latter does. To use ascending
|
|
|
- order for your page navigation again, add Twigs <code>reverse</code> filter to the
|
|
|
- navigation loop (<code>{% for page in pages|reverse %}...{% endfor %}}</code>)
|
|
|
- in your themes <code>index.twig</code>.
|
|
|
+ Let Pico sort pages by date by setting <code>$config['pages_order_by'] = 'date';</code> in your <code>config/config.php</code>. To use a descending order (newest articles first), also add <code>$config['pages_order'] = 'desc';</code>. The former won't affect pages without a <code>Date</code> meta header, but the latter does. To use ascending order for your page navigation again, add Twigs <code>reverse</code> filter to the navigation loop (<code>{% for page in pages|reverse %}...{% endfor %}}</code>) in your themes <code>index.twig</code>.
|
|
|
</li>
|
|
|
<li>
|
|
|
- Make sure to exclude the blog articles from your page navigation. You can
|
|
|
- achieve this by adding <code>{% if not page starts with "blog/" %}...{% endif %}</code>
|
|
|
- to the navigation loop.
|
|
|
+ Make sure to exclude the blog articles from your page navigation. You can achieve this by adding <code>{% if not page starts with "blog/" %}...{% endif %}</code> to the navigation loop.
|
|
|
</li>
|
|
|
</ol>
|
|
|
+
|
|
|
+[Markdown]: http://daringfireball.net/projects/markdown/syntax
|