-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation
To run Zepto you need at least PHP 5.3+ running on your server. If you're running Apache, you will also require mod_rewrite to be enabled.
Use Composer to download the latest version of Zepto.
composer require hassankhan/zepto
Then add the following to the top of your index.php
file:
<?php
require 'vendor/autoload.php';
Upload the files to your server (via FTP or some other deployment).
That's it. Tweak the .htaccess
file if you need to.
You can override the default Zepto settings (and add your own custom settings) by editing config.php
in the root Zepto directory. The config file lists all of the settings and their defaults. To override a setting simply uncomment it in config.php
and set your own value.
Zepto is a flat-file CMS, so there's very little backend and no database to deal with. You simply create .md
or .markdown
files in the content
folder and that becomes a page.
If you created folder within the content folder (e.g. content/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/sub/page.md
) and will be able to access it from the URL http://yoursite.com/sub/page
.
Below are some examples of content locations and their corresponding URLs:
Physical Location | URL |
---|---|
content/index.md | / |
content/sub/index.md | /sub |
content/sub/page.md | sub/page |
content/a/very/long/url.md | /a/very/long/url |
If a file cannot be found, a HTTP status 404 is sent and the 'Page Not Found' page is displayed.
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 {{ meta }}
variable in themes (see below).
Zepto uses Twig for templating, and therefore assumes you already know how to use it. There's already a base.twig
in the templates
folder, but you can always put your own Twig templates in there.
You'll have the following variables available to you in every template:
{{ meta }} - Contains the meta values from the current page
{{ meta.title }}
{{ meta.description }}
{{ meta.author }} // Should contain at least these three, the next three are optional
{{ meta.date }}
{{ meta.date_formatted }}
{{ meta.robots }}
{{ contents }} - The contents of the current page (after it has been processed through Markdown)
{{ nav }} - Returns a HTML-formatted representation of the content folder, if you're using the ``NavGenPlugin``
You will also have access to the following helper functions:
{{ url_for('name-of-file.md') }} - Returns the fully-qualified URL for the file
{{ link_for('name-of-file.md') }} - Returns an <a> tag for the file
{{ config('setting-name') }} - Contains config.php
{{ site_url() }} - The site URL as defined in config.php
{{ site_title() }} - The site title as defined in config.php
Zepto comes with some extra Zepto\Route
objects that ...
To add a custom route to your application, add them before you call $zepto->run()
:
$router = new Zepto\Router();
$router->route(new Zepto\Route\ListRoute('/'));
$router->route(new Zepto\Route\TagRoute('/tags/<:tag_name>'));
$router->route(new Zepto\Route\AtomRoute('/feed'));
$router->run();
This builds an Atom 1.0 feed, sets the HTTP response header 'content-type' to 'application/xml'.
This creates a route which shows all posts. It can also get post excerpts, the length of which depends on the setting site.excerpt_newline_limit
.
This extends ListRoute
, but shows all posts that have a tag. You must use a route pattern of the form '/tags/<:tag_name>'
.s
Help make Zepto better by checking out the GitHub repository and submitting pull requests. If you find a bug please report it on the issues page.