[FEATURE] Multi Template Support
this patch makes it possible to use different templates by define the template in the meta section of the *.md files. This is the first patch for multi column support. To use an other template like index.html you can now define Template: content-sidebar which renders the template "content-sidebar.html".
This commit is contained in:
parent
6acc979655
commit
b0cb72272d
3 changed files with 55 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
Title: Welcome
|
||||
Description: This description will go in the meta description tag
|
||||
Template: content-sidebar
|
||||
*/
|
||||
|
||||
## Welcome to Pico
|
||||
|
|
|
@ -99,7 +99,8 @@ class Pico {
|
|||
'is_front_page' => $url ? false : true,
|
||||
);
|
||||
$this->run_hooks('before_render', array(&$twig_vars, &$twig));
|
||||
$output = $twig->render('index.html', $twig_vars);
|
||||
$template = (isset($meta['template']) && strlen($meta['template']) > 0) ? $meta['template'] : 'index';
|
||||
$output = $twig->render("{$template}.html", $twig_vars);
|
||||
$this->run_hooks('after_render', array(&$output));
|
||||
echo $output;
|
||||
}
|
||||
|
@ -153,7 +154,8 @@ class Pico {
|
|||
'description' => 'Description',
|
||||
'author' => 'Author',
|
||||
'date' => 'Date',
|
||||
'robots' => 'Robots'
|
||||
'robots' => 'Robots',
|
||||
'template' => 'Template'
|
||||
);
|
||||
|
||||
// Add support for custom headers by hooking into the headers array
|
||||
|
|
50
themes/default/content-sidebar.html
Normal file
50
themes/default/content-sidebar.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<title>{% if meta.title %}{{ meta.title }} | {% endif %}{{ site_title }}</title>
|
||||
{% if meta.description %}
|
||||
<meta name="description" content="{{ meta.description }}">
|
||||
{% endif %}{% if meta.robots %}
|
||||
<meta name="robots" content="{{ meta.robots }}">
|
||||
{% endif %}
|
||||
|
||||
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,700" type="text/css" />
|
||||
<link rel="stylesheet" href="{{ theme_url }}/style.css" type="text/css" />
|
||||
|
||||
<script src="{{ theme_url }}/scripts/modernizr-2.6.1.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header id="header">
|
||||
<div class="inner clearfix">
|
||||
<h1><a href="{{ base_url }}">{{ site_title }}</a></h1>
|
||||
<ul class="nav">
|
||||
{% for page in pages %}
|
||||
<li><a href="{{ page.url }}">{{ page.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section id="content">
|
||||
<div class="inner">
|
||||
<div class="column_content">
|
||||
{{ column_content }}
|
||||
</div>
|
||||
<div class="column_sidebar">
|
||||
{{ column_sidebar }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer id="footer">
|
||||
<div class="inner">
|
||||
<a href="http://pico.dev7studios.com">Pico</a> was made by <a href="http://gilbert.pellegrom.me">Gilbert Pellegrom</a>
|
||||
from <a href="http://dev7studios.com">Dev7studios</a>.
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue