diff --git a/docs.html b/docs.html index 3bd1728..660b30d 100644 --- a/docs.html +++ b/docs.html @@ -8,289 +8,18 @@ nav: 2

Pico Documentation

- Pico is a flat file CMS, this means there is no administration backend and database to deal with.
+ 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" folder and that becomes a page.


- +
-

Requirements

-

- To run Pico you simply need PHP 5.3+ to be running on your server. - If you're running Apache you will require mod_rewrite to be enabled. -

- -
- -

Installation

-
    -
  1. First download and extract the latest version of Pico.
  2. -
  3. Upload the files to your server (via FTP or some other deployment).
  4. -
  5. Download composer and run it with install option.
  6. - -
    
    -                $ curl -sS https://getcomposer.org/installer | php
    -                $ php composer.phar install
    -                
    - -
  7. The easiest way to Pico is using the built-in web server on PHP.
  8. - -
    
    -                $ php -S 0.0.0.0:8080 ./
    -                
    - -
  9. Pico will be accessible from http://localhost:8080.
  10. -
  11. That's it. Tweak the .htaccess file if required.
  12. -

- -

You can override the default Pico settings (and add your own custom settings) by editing config/config.php in the Pico directory. The config/config.php.template lists all of the settings and their defaults. To override a setting simply copy config/config.php.template to config/config.php, uncomment the setting and set your custom value.

- -
- -

Creating Content

-

- Pico is a flat file CMS, this means there is no administration backend and database to deal with. - You simply create .md files in the "content-sample" folder and that becomes a page. -

-

- If you created folder within the content-sample 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 (e.g. content-sample/sub/page.md) - and will be able to access it from the URL http://yoursite.com/sub/page. -

- -

Below we've shown some examples of content locations and their corresponing URL's:

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Physical LocationURL
content-sample/index.md/
content-sample/sub.md/sub
content-sample/sub/index.md/sub (same as above)
content-sample/sub/page.md/sub/page
content-sample/a/very/long/url.md     /a/very/long/url

- -

If a file cannot be found, the file content-sample/404.md will be shown.

- -

Text File Markup

-

- 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: -

-

-                /*
-                Title: Welcome
-                Description: This description will go in the meta description tag
-                Author: Joe Bloggs
-                Date: 2013/01/01
-                Robots: noindex,nofollow
-                Template: index (allows you to use different templates in your theme)
-                */
-            
-

- 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: -

- - -
- -

Themeing

-

- You can create themes for your Pico installation and in the "themes" folder. Check out the default theme for an example of a theme. Pico uses - Twig for it's templating engine. You can select your theme by setting the $config['theme'] variable - in config/config.php to your theme folder. -

-

All themes must include an index.html file to define the HTML structure of the theme. Below are the Twig variables that are available to use in your theme:

- - -

Pages can be used like:

-
{% raw %}<ul class="nav">
-            {% for page in pages %}
-            <li><a href="{{ page.url }}">{{ page.title }}</a></li>
+            {% for doc in site.docs %}
+                
+                {{ doc.output }}
             {% endfor %}
-            </ul>{% endraw %}
- -

Blogging

-

If you would like to add a blog to your Pico site we suggest taking the following steps:

- - -
{% raw %}{% if is_front_page %} <!-- Front page lists all blog posts -->
-
-            <div id="posts">
-            {% for page in pages %}
-            {% if page.date %} <!-- Note we check for Date field (posts) here -->
-            <div class="post">
-            <h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
-            <p class="meta">{{ page.date_formatted }}</p>
-            <p class="excerpt">{{ page.excerpt }}</p>
-            </div>
-            {% endif %}
-            {% endfor %}
-            </div>
-
-            {% else %} <!-- Single page shows individual blog post -->
-
-            <div class="post">
-            {% if meta.title %}<h2>{{ meta.title }}</h2>{% endif %}
-            <p class="meta">{{ meta.date_formatted }}</p>
-            {{ content }}
-            </div>
-
-            {% endif %}{% endraw %}
- -
- -

Plugins

-

- Plugins can be created by creating a new PHP file and placing it in the "plugins" folder. Plugins can be placed - in a sub folder if required. In your new plugin PHP file you need to create class with the same name as - the file. So if you create a file called my_plugin.php your class needs to be called My_Plugin. -

- -

- Plugins can hook into Pico by adding functions with predefined names (hooks) to their class. For example you could - add a custom template variable by adding a before_render hook: -

-
class My_Plugin {
-
-            public function before_render(&$twig_vars, &$twig)
-            {
-            // Add a custom template variable
-            $twig_vars['my_custom_var'] = 'Hello World';
-            }
-
-            }
- -

Below is a list of available hooks and their parameters:

- -

- Note that parameter variables are passed by reference - so that they can be modified. -

- -

Adding Custom Meta

-

If you need to add custom meta variables you can do so using the before_read_file_meta() hook. For example:

-
public function before_read_file_meta(&$headers)
-            {
-            $headers['layout'] = 'Layout';
-            }
- -

Then in your content meta you would add the relevant meta value:

-
/*
-            Title: Example
-            Description: This is a description
-            Layout: 2col
-            */
-            
- -

You will then be able to access this value via the {% raw %}{{ meta.layout }}{% endraw %} template variable.

- -
- -

Contribute

-

- Help make Pico better by checking out the GitHub repository and submitting pull requests. If you find a bug - please report it on the issues page. -