ene spremembe + iz Syncthing bom prešaltal na Nextcloud
|
@ -1,5 +1,5 @@
|
|||
.git
|
||||
// .gitignore
|
||||
/.git
|
||||
/.gitignore
|
||||
|
||||
// ignorirani fajli, ki jih rabi NextCloud
|
||||
/._sync_504320134e4a.db
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# Link do sajta:
|
||||
|
||||
```
|
||||
http://zapatista.kompot.si
|
||||
```
|
||||
```
|
||||
[http://zapatista.kompot.si](http://zapatista.kompot.si)
|
BIN
assets/image.png
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 227 KiB After Width: | Height: | Size: 227 KiB |
Before Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 227 KiB |
|
@ -1,10 +1,11 @@
|
|||
##
|
||||
# Basic
|
||||
#
|
||||
site_title: Pico # The title of your website
|
||||
site_title: Zapatistična pot # The title of your website
|
||||
site_subtitle: Srečevanja bojev, dostojanstva, življenja - regionalna koordinacija
|
||||
base_url: ~ # Pico will try to guess its base URL, if this fails, override it here;
|
||||
# Example: https://example.com/pico/
|
||||
rewrite_url: ~ # A boolean (true or false) indicating whether URL rewriting is forced
|
||||
rewrite_url: ~ # A boolean (true or false) indicating whether URL rewriting is forced
|
||||
debug: ~ # Set this to true to enable Pico's debug mode
|
||||
timezone: ~ # Your PHP installation might require you to manually specify a timezone
|
||||
locale: ~ # Your PHP installation might require you to manually specify a locale to use
|
||||
|
@ -23,16 +24,16 @@ twig_config: # Twig template engine config
|
|||
charset: utf-8 # The charset used by Twig templates
|
||||
debug: ~ # Enable Twig's debug mode
|
||||
cache: false # Enable Twig template caching by specifying a path to a writable directory
|
||||
auto_reload: ~ # Recompile Twig templates whenever the source code changes
|
||||
auto_reload: true # Recompile Twig templates whenever the source code changes
|
||||
|
||||
##
|
||||
# Content
|
||||
#
|
||||
date_format: %D %T # Pico's default date format;
|
||||
date_format: %d. %m. %Y # Pico's default date format;
|
||||
# See https://php.net/manual/en/function.strftime.php for more info
|
||||
pages_order_by_meta: author # Sort pages by meta value "author" (set "pages_order_by" to "meta")
|
||||
pages_order_by: alpha # Change how Pico sorts pages ("alpha" for alphabetical order, "date", or "meta")
|
||||
pages_order: asc # Sort pages in ascending ("asc") or descending ("desc") order
|
||||
pages_order_by: date # Change how Pico sorts pages ("alpha" for alphabetical order, "date", or "meta")
|
||||
pages_order: desc # Sort pages in ascending ("asc") or descending ("desc") order
|
||||
content_dir: ~ # The path to Pico's content directory
|
||||
content_ext: .md # The file extension of your Markdown files
|
||||
content_config: # Parsedown Markdown parser config
|
||||
|
|
|
@ -1,92 +1,7 @@
|
|||
---
|
||||
Title: Zapatisti prihajajo
|
||||
Description: Spletno mesto za obveščanje o anarhističnem organiziranju
|
||||
Template: index-novice
|
||||
---
|
||||
|
||||
## Tukajle je ena
|
||||
|
||||
Damo kakšno sliko tukaj?
|
||||
![Ladjica](%assets_url%/prva_slika.jpeg)
|
||||
|
||||
## Primer iz privzete teme:
|
||||
|
||||
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 those files become your pages. For example, this file is called `index.md`
|
||||
and is shown as the main landing page.
|
||||
|
||||
When you install Pico, it comes with some sample contents that will display
|
||||
until you add your own content. Simply add some `.md` files to your `content`
|
||||
folder in Pico's root directory. No configuration is required, Pico will
|
||||
automatically use the `content` folder as soon as you create your own
|
||||
`index.md`. Just check out [Pico's sample contents][SampleContents] for an
|
||||
example!
|
||||
|
||||
If you create a folder within the content directory (e.g. `content/sub`) and
|
||||
put an `index.md` inside it, you can access that folder at the URL
|
||||
`%base_url%?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/sub/page.md` is accessible from the URL `%base_url%?sub/page`).
|
||||
Below we've shown some examples of locations and their corresponding URLs:
|
||||
|
||||
## Primer tabele
|
||||
|
||||
<table style="width: 100%; max-width: 40em;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50%;">Physical Location</th>
|
||||
<th style="width: 50%;">URL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>content/index.md</td>
|
||||
<td><a href="%base_url%">/</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>content/sub.md</td>
|
||||
<td><del>?sub</del> (not accessible, see below)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>content/sub/index.md</td>
|
||||
<td><a href="%base_url%?sub">?sub</a> (same as above)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>content/sub/page.md</td>
|
||||
<td><a href="%base_url%?sub/page">?sub/page</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>content/theme.md</td>
|
||||
<td><a href="%base_url%?theme">?theme</a> (hidden in menu)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>content/a/very/long/url.md</td>
|
||||
<td>
|
||||
<a href="%base_url%?a/very/long/url">?a/very/long/url</a>
|
||||
(doesn't exist)
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Dokumentacija
|
||||
|
||||
For more help have a look at the Pico documentation at http://picocms.org/docs.
|
||||
|
||||
[Pico]: http://picocms.org/
|
||||
[PicoTheme]: https://github.com/picocms/pico-theme
|
||||
[App]: https://apps.nextcloud.com/apps/cms_pico
|
||||
[SampleContents]: https://github.com/picocms/Pico/tree/master/content-sample
|
||||
[Markdown]: http://daringfireball.net/projects/markdown/syntax
|
||||
[MarkdownExtra]: https://michelf.ca/projects/php-markdown/extra/
|
||||
[YAML]: https://en.wikipedia.org/wiki/YAML
|
||||
[Twig]: http://twig.sensiolabs.org/documentation
|
||||
[UnixTimestamp]: https://en.wikipedia.org/wiki/Unix_timestamp
|
||||
[Composer]: https://getcomposer.org/
|
||||
[FeaturesHttpParams]: http://picocms.org/in-depth/features/http-params/
|
||||
[FeaturesPageTree]: http://picocms.org/in-depth/features/page-tree/
|
||||
[FeaturesPagesFunction]: http://picocms.org/in-depth/features/pages-function/
|
||||
[WikiThemes]: https://github.com/picocms/Pico/wiki/Pico-Themes
|
||||
[WikiPlugins]: https://github.com/picocms/Pico/wiki/Pico-Plugins
|
||||
[OfficialThemes]: http://picocms.org/themes/
|
||||
[PluginUpgrade]: http://picocms.org/development/#upgrade
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
---
|
||||
|
||||
## Title: Kdo smo?
|
||||
Title: Kdo smo?
|
||||
Description: mi smo
|
||||
|
||||
---
|
||||
|
||||
# Kdo smo?
|
||||
|
|
|
@ -5,5 +5,5 @@ title: Navigation bar
|
|||
- [Domov](%base_url%)
|
||||
- [Kdo smo?](%base_url%?kdosmo)
|
||||
- [Izjava za življenje](%base_url%?izjava)
|
||||
- [Novice](%base_url%?gora)
|
||||
- [Novice](%base_url%?novice/gora)
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
|
||||
## Title: Gora na odprtem morju
|
||||
Title: Gora na odprtem morju
|
||||
Description: Sedem ljudi bo sestavljala pomorska enota zapatistične delegacije, ki poleti prihaja v Evropo.
|
||||
Date: 2021-05-05
|
||||
|
||||
---
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
|
||||
---
|
||||
|
||||
* ![Ladjica](%assets_url%/prva_slika.png)
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Nicolas Liautaud
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
/**
|
||||
* Flat and nested pages list navigation for Pico CMS.
|
||||
*
|
||||
* - Adds twig global `{{ nested_pages }}` in addition to `{{ pages }}`
|
||||
* - Render flat or nested HTML navigation tree with `navigation` twig filter
|
||||
* - Filter pages and nested pages by paths with `exclude()` and `only()` twig filters
|
||||
*
|
||||
* Examples :
|
||||
*
|
||||
* {{ pages | navigation }} // output a flat pages list
|
||||
* {{ nested_pages | navigation }} // output a nested pages list
|
||||
* {{ nested_pages | exclude('sub/page') | navigation }} // filtered nested pages list
|
||||
* {% assign filtered = pages | only('sub/path/') %} // get filtered flat pages array
|
||||
*
|
||||
* @author Nicolas Liautaud
|
||||
* @link https://github.com/nliautaud/pico-pages-list
|
||||
* @link http://picocms.org
|
||||
* @license http://opensource.org/licenses/MIT The MIT License
|
||||
*/
|
||||
class PicoPagesList extends AbstractPicoPlugin
|
||||
{
|
||||
const API_VERSION = 3;
|
||||
|
||||
protected $items;
|
||||
|
||||
/**
|
||||
* Construct the nested pages array.
|
||||
*
|
||||
* Triggered after Pico has read all known pages
|
||||
*
|
||||
* See {@link DummyPlugin::onSinglePageLoaded()} for details about the
|
||||
* structure of the page data.
|
||||
*
|
||||
* @see Pico::getPages()
|
||||
* @param array[] &$pages data of all known pages
|
||||
* @return void
|
||||
*/
|
||||
public function onPagesLoaded(array &$pages)
|
||||
{
|
||||
$this->items = $this->nestedPages($pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register `$this` in the Twig `{{ PagesList }}` variable.
|
||||
*
|
||||
*
|
||||
* @see Pico::getTwig()
|
||||
* @param Twig_Environment &$twig Twig instance
|
||||
* @return void
|
||||
*/
|
||||
public function onTwigRegistered(Twig_Environment &$twig)
|
||||
{
|
||||
$twig->addFilter(new Twig_SimpleFilter('navigation', function($pages) {
|
||||
return $this->output($pages);
|
||||
}, array('is_safe' => array('html'))));
|
||||
|
||||
$twig->addFilter(new Twig_SimpleFilter('exclude', function($pages, array $paths = array()) {
|
||||
return $this->filterPages($pages, $paths);
|
||||
}, array('is_variadic' => true)));
|
||||
|
||||
$twig->addFilter(new Twig_SimpleFilter('only', function($pages, array $paths = array()) {
|
||||
return $this->filterPages($pages, $paths, true);
|
||||
}, array('is_variadic' => true)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register `$this` in the Twig `{{ PagesList }}` variable.
|
||||
*
|
||||
* Triggered before Pico renders the page
|
||||
*
|
||||
* @see Pico::getTwig()
|
||||
* @see DummyPlugin::onPageRendered()
|
||||
* @param string &$templateName file name of the template
|
||||
* @param array &$twigVariables template variables
|
||||
* @return void
|
||||
*/
|
||||
public function onPageRendering(string &$templateName, array &$twigVariables)
|
||||
{
|
||||
$twigVariables['nested_pages'] = $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the nested pages array according to the pages paths.
|
||||
*
|
||||
* @see nested_path
|
||||
* @param array $pages Pico pages flat array
|
||||
*/
|
||||
private function nestedPages($pages)
|
||||
{
|
||||
$this->items = array();
|
||||
foreach ($pages as $page) {
|
||||
$nested_path = $this->nested_path($page);
|
||||
$this->items = array_replace_recursive($this->items, $nested_path);
|
||||
}
|
||||
return $this->items['_childs'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a nested array of a given path, with the page at the end.
|
||||
* Each path fragment is in "_childs" of the parent.
|
||||
*
|
||||
* @param array $page the page array
|
||||
* @return array the nested path
|
||||
*/
|
||||
private function nested_path($page)
|
||||
{
|
||||
$path = self::rtrim($page['id'], '/index');
|
||||
$parts = explode('/', $path);
|
||||
$count = count($parts);
|
||||
|
||||
$arr = array();
|
||||
$parent = &$arr;
|
||||
foreach($parts as $id => $part) {
|
||||
$value = [];
|
||||
if(!$part || $id == $count-1) {
|
||||
$value = $page;
|
||||
} else {
|
||||
$currpath = implode('/', array_slice($parts, 0, $id+1));
|
||||
$value['id'] = $currpath;
|
||||
}
|
||||
if($path && !$part) {
|
||||
$parent = $value;
|
||||
break;
|
||||
}
|
||||
|
||||
$parent['_childs'][$part] = $value;
|
||||
$parent = &$parent['_childs'][$part];
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip a substring from the end of a string
|
||||
*
|
||||
* @param array $str The input string.
|
||||
* @param array $substr The substring to remove.
|
||||
* @return string The modified string.
|
||||
*/
|
||||
private static function rtrim($str, $substr)
|
||||
{
|
||||
$length = strlen($substr);
|
||||
return (substr($str, -$length) === $substr) ? substr($str, 0, -$length) : $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the pages array according to given paths, as exclusive or inclusive.
|
||||
*
|
||||
* @param array $pages The flat or nested pages array.
|
||||
* @param array $filteredPaths The paths to filter.
|
||||
* @param boolean $isInclusive If `true` only corresponding paths are kept.
|
||||
* @return array The filtered array of pages.
|
||||
*/
|
||||
public static function filterPages(
|
||||
$pages,
|
||||
$filteredPaths,
|
||||
$isInclusive = false,
|
||||
$inclusiveOutput = []
|
||||
) {
|
||||
foreach($pages as $i => $page) {
|
||||
if (!isset($page['id'])) return;
|
||||
|
||||
$path = self::rtrim($page['id'], '/index');
|
||||
$isSubPath = self::isSubPath($path, $filteredPaths);
|
||||
if ($isSubPath) {
|
||||
if ($isInclusive) $inclusiveOutput[$i] = $page;
|
||||
else unset($pages[$i]);
|
||||
continue;
|
||||
}
|
||||
if (isset($page['_childs'])) {
|
||||
$childs = self::filterPages($page['_childs'], $filteredPaths, $isInclusive, $inclusiveOutput);
|
||||
if ($isInclusive) $inclusiveOutput = $childs;
|
||||
else $pages[$i]['_childs'] = $childs;
|
||||
}
|
||||
}
|
||||
return $isInclusive ? $inclusiveOutput : $pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the given path is a subpath of the given parent path(s)
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $parentPaths array of paths
|
||||
* @return boolean
|
||||
*/
|
||||
private static function isSubPath($path, $parentPaths)
|
||||
{
|
||||
foreach($parentPaths as $p) {
|
||||
if (!is_string($p)) continue;
|
||||
if ($path == $p) return true;
|
||||
if (strncmp($path, $p, strlen($p)) === 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an html nested list based on a nested pages array.
|
||||
*
|
||||
* @param array $pages a nested pages array
|
||||
* @return string the html list
|
||||
*/
|
||||
private function output($pages)
|
||||
{
|
||||
if (!is_array($pages)) return;
|
||||
$html = '<ul>';
|
||||
foreach ($pages as $pageID => $page)
|
||||
{
|
||||
if (!empty($page['hidden'])) continue;
|
||||
|
||||
$childsOutput = '';
|
||||
if(isset($page['_childs'])) {
|
||||
$childsOutput = $this->output($page['_childs']);
|
||||
}
|
||||
|
||||
$url = isset($page['url']) ? $page['url'] : false;
|
||||
|
||||
// use title if the page has one and make a link if the page exists.
|
||||
if(!$url) $item = "<span>$pageID</span>";
|
||||
else {
|
||||
$name = !empty($page['title']) ? $page['title'] : $pageID;
|
||||
$item = "<a href=\"$url\">$name</a>";
|
||||
}
|
||||
|
||||
// add the pageID in class and indicate if it is the current or parent of the current page.
|
||||
$class = $pageID;
|
||||
$class .= $url ? ' is-page' : ' is-directory';
|
||||
if ($childsOutput) $class .= ' has-childs';
|
||||
|
||||
$currentPage = $this->getPico()->getCurrentPage();
|
||||
if ($currentPage && $currentPage['id']) {
|
||||
if ($currentPage['id'] === $page['id']) {
|
||||
$class .= ' is-current is-active';
|
||||
} elseif ($page['id'] !== 'index') {
|
||||
$pagePath = (basename($page['id']) === 'index') ? dirname($page['id']) . '/' : $page['id'] . '/';
|
||||
if (substr_compare($pagePath, $currentPage['id'], 0, strlen($pagePath)) === 0) $class .= ' is-active';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= "<li class=\"$class\">$item$childsOutput</li>";
|
||||
}
|
||||
$html .= '</ul>';
|
||||
return $html;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
# Pico Pages List
|
||||
|
||||
A flat and nested pages lists plugin for [Pico CMS](http://picocms.org).
|
||||
|
||||
- `{{ nested_pages }}` array
|
||||
- nested or flat html navigations
|
||||
- pages links and directories structures
|
||||
- versatile html/css for dropdown menus, single-line breadcrumbs...
|
||||
- `exclude` and `only` pages filters
|
||||
|
||||
[![Examples](examples/capture.png)](http://pico.nliautaud.fr/PicoPagesList)
|
||||
|
||||
Demo : http://pico.nliautaud.fr/PicoPagesList
|
||||
|
||||
## Installation
|
||||
|
||||
Copy `PicoPagesList.php` to the `plugins` directory of your Pico Project.
|
||||
|
||||
## Usage
|
||||
|
||||
Create a nested HTML navigation tree with :
|
||||
|
||||
```twig
|
||||
{{ nested_pages | navigation }}
|
||||
```
|
||||
|
||||
The nested navigation will look like that :
|
||||
|
||||
* [A cool page]()
|
||||
* [Sub-page is coming]()
|
||||
* [The choosen one]()
|
||||
* category
|
||||
* [A page]()
|
||||
* [untitled]()
|
||||
|
||||
The global `nested_pages` and the filter `navigation` render an HTML navigation. Works on `{{ pages }}` too.
|
||||
|
||||
```twig
|
||||
{{ pages | navigation }} // output a flat pages list
|
||||
```
|
||||
|
||||
## Filtering
|
||||
|
||||
The plugin create two additionnal Twig filters, `exclude()` and `only()`, that filters the given pages array (`pages` or `nested_pages`) by paths.
|
||||
|
||||
```twig
|
||||
pages | exclude('path/') // exclude the page located under "path/"
|
||||
pages | only('path/') // return only the page located at "path/"
|
||||
```
|
||||
|
||||
Use the leading slath to target index pages or not.
|
||||
|
||||
```twig
|
||||
pages | exclude('sub/dir/') // exclude the page located under "sub/dir/", but not "sub/dir" (index)
|
||||
pages | exclude('sub/dir') // exclude "sub/dir" (index) and pages located under "sub/dir/"
|
||||
```
|
||||
|
||||
You can specify multiple paths at once by using multiple arguments.
|
||||
|
||||
```twig
|
||||
exclude('sub/dir', 'page')
|
||||
only('sub/dir', 'page')
|
||||
```
|
||||
|
||||
### Styling
|
||||
|
||||
The default html output is a clean nested list with extra classes that provides the possibility to build hierarchical navigations and to target specific pages and directories.
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li class="titled is-page">
|
||||
<a href="http://mysite.com/titled">A cool page</a>
|
||||
</li>
|
||||
<li class="foo is-page has-childs is-current">
|
||||
<a href="http://mysite.com/foo">Sub-page is coming</a>
|
||||
<ul>
|
||||
<li class="child is-page has-childs is-current is-active">
|
||||
<a href="http://mysite.com/foo/child">The choosen one</a>
|
||||
</li>
|
||||
<li class="category is-directory has-childs">
|
||||
<span>category</span>
|
||||
<ul>
|
||||
<li class="bar is-page">
|
||||
<a href="http://mysite.com/foo/category/bar">A page</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="untitled is-page">
|
||||
<a href="http://mysite.com/untitled">untitled</a>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
```css
|
||||
.foo-item { /* an item named "foo-item" */ }
|
||||
.foo-item > a { /* the link of a page named "foo-item" */ }
|
||||
.foo-item > span { /* the name of a directory named "foo-item" */ }
|
||||
.foo-item > ul { /* the childs of "foo-item" */ }
|
||||
.foo-item > ul ul { /* the deep childs of "foo-item" */ }
|
||||
|
||||
.is-page { /* the pages, with links */ }
|
||||
.is-directory { /* the directories, with simple names */ }
|
||||
.is-current { /* the current page */ }
|
||||
.is-active { /* the items in the path of the current page */ }
|
||||
.has-childs { /* the items with childs */ }
|
||||
```
|
||||
|
||||
As a simple example, you may show sub-pages only if their parent is active :
|
||||
|
||||
```css
|
||||
.mymenu li.is-page:not(.is-active) ul {
|
||||
display: none;
|
||||
}
|
||||
```
|
||||
|
||||
## Custom loop
|
||||
|
||||
The `{{ nested_pages }}` global is an array of pages, similar to `{{ pages }}`, where sub-pages are nested into `_childs`.
|
||||
|
||||
You may want a recursive Twig template or macro to walk trough it, for example :
|
||||
|
||||
```twig
|
||||
{% macro menu(items) %}
|
||||
<ul>
|
||||
{% for name,item in items %}
|
||||
<li>
|
||||
{% if item.url %}
|
||||
<a href="{{ item.url }}">{{ item.title }}</a> : {{ item.description }}
|
||||
{% else %}
|
||||
<span>{{ name }}</span>
|
||||
{% endif %}
|
||||
{% if item._childs %}
|
||||
{% import _self as macros %}
|
||||
{{ macros.menu(item._childs) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% import _self as macros %}
|
||||
{{ macros.menu(nested_pages) }}
|
||||
```
|
||||
|
||||
## Settings
|
||||
|
||||
The lists are sorted according to the default settings in Pico `config.php`.
|
||||
|
||||
```yml
|
||||
pages_order_by: date
|
||||
pages_order: desc
|
||||
```
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "nliautaud/pico-pages-list",
|
||||
"type": "pico-plugin",
|
||||
"description": "A pages lists plugin for Pico CMS, with nested pages, pages filtering and HTML navigation.",
|
||||
"keywords": [ "pico", "picocms", "picocms-plugin", "pico-pages-list"],
|
||||
"homepage": "http://picocms.org/",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Liautaud",
|
||||
"homepage": "https://github.com/nliautaud/pico-pages-list",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/nliautaud/pico-pages-list/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://github.com/nliautaud/pico-pages-list/blob/master/README.md",
|
||||
"issues": "https://github.com/nliautaud/pico-pages-list/issues",
|
||||
"source": "https://github.com/nliautaud/pico-pages-list"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [ "PicoPagesList.php" ]
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 47 KiB |
|
@ -0,0 +1,162 @@
|
|||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.pageslist-demo .item {
|
||||
border: 1px solid #eee;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 5px #0001;
|
||||
margin: 1em;
|
||||
}
|
||||
.pageslist-demo .item.span {
|
||||
grid-column: 1 / span 2;
|
||||
}
|
||||
.pageslist-demo .desc {
|
||||
background: #2EAE9B;
|
||||
color: white;
|
||||
font-size: .8em;
|
||||
overflow: auto;
|
||||
}
|
||||
.pageslist-demo .desc p {
|
||||
margin: 1em;
|
||||
}
|
||||
.pageslist-demo .desc code {
|
||||
font-family: inherit;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
background: #456;
|
||||
padding: .25em .5em;
|
||||
margin: 1em;
|
||||
display: block;
|
||||
white-space: pre-wrap;
|
||||
font-size: 1em;
|
||||
}
|
||||
.pageslist-demo ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 1em;
|
||||
}
|
||||
.pageslist-demo ul ul {
|
||||
padding-left: 1.5em;
|
||||
margin: 0;
|
||||
}
|
||||
.pageslist-demo .is-active a {
|
||||
font-style: italic;
|
||||
}
|
||||
.pageslist-demo .is-current a {
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
}
|
||||
.pageslist-demo a::before,
|
||||
.pageslist-demo span::before {
|
||||
content: "▹";
|
||||
vertical-align: middle;
|
||||
margin-right: .5em;
|
||||
color: grey;
|
||||
font: normal 1.2em normal mono;
|
||||
}
|
||||
.pageslist-demo .has-childs > a::before,
|
||||
.pageslist-demo .has-childs > span::before {
|
||||
content: "▾";
|
||||
}
|
||||
</style>
|
||||
<div class="pageslist-demo">
|
||||
<div class="grid">
|
||||
<div class="item">
|
||||
<div class="desc">
|
||||
<p>Generate a flat navigation using the default page array.</p>
|
||||
<code>{% raw %}{{ pages | navigation }}{% endraw %}</code>
|
||||
</div>
|
||||
{{ pages | navigation }}
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="desc">
|
||||
<p>Generate a nested navigation using the nested array.</p>
|
||||
<code>{% raw %}{{ nested_pages | navigation }}{% endraw %}</code>
|
||||
</div>
|
||||
{{ nested_pages | navigation }}
|
||||
</div>
|
||||
<div class="item span">
|
||||
<div class="desc">
|
||||
<p>The html structure and the css classes allows styling current page, active parent pages, naked directories, getting pages by name, etc. to build any type of navigation : dropdown menus, single-lined breadcrumbs...
|
||||
</p>
|
||||
<code>{% raw %}.is-page, .is-directory, .is-current, .is-active, .has-childs ...{% endraw %}</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="desc">
|
||||
<p>Filtering pages paths with the <i>exclude</i> filter : </p>
|
||||
<code>{% raw %}{{ nested_pages | exclude('PicoPagesList') | navigation }}{% endraw %}</code>
|
||||
</div>
|
||||
{{ nested_pages | exclude('PicoPagesList') | navigation }}
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="desc">
|
||||
<p>Filter the inner pages by using a trailing slash : </p>
|
||||
<code>{% raw %}{{ nested_pages | exclude('PicoPagesList/') | navigation }}{% endraw %}</code>
|
||||
</div>
|
||||
{{ nested_pages | exclude('PicoPagesList/') | navigation }}
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="desc">
|
||||
<p>Filter all pages except the given ones with <i>only</i>, and chain filters : </p>
|
||||
<code>{% raw %}{{ nested_pages | only('PicoPagesList') | exclude('PicoPagesList/sub/bar') | navigation }}{% endraw %}</code>
|
||||
</div>
|
||||
{{ nested_pages | only('PicoPagesList') | exclude('PicoPagesList/sub/bar') | navigation }}
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="desc">
|
||||
<p>Filters can be given multiple paths : </p>
|
||||
<code>{% raw %}{{ nested_pages | only('PicoPagesList/sub', 'index') | navigation }}{% endraw %}</code>
|
||||
</div>
|
||||
{{ nested_pages | only('PicoPagesList/sub', 'index') | navigation }}
|
||||
</div>
|
||||
<div class="item span">
|
||||
<div class="desc">
|
||||
<p>Custom loop :</p>
|
||||
<code>{% raw %}{% macro menu(items) %}
|
||||
<ul>
|
||||
{% for name,item in items %}
|
||||
<li>
|
||||
{% if item.url %}
|
||||
<a href="{{ item.url }}">{{ item.title }}</a> : {{ item.description }}
|
||||
{% else %}
|
||||
<span>{{ name }}</span>
|
||||
{% endif %}
|
||||
{% if item._childs %}
|
||||
{% import 'macros.twig' as macros %}
|
||||
{{ macros.menu(item._childs) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}{% endraw %}</code>
|
||||
|
||||
<code>{% raw %}{% import 'macros.twig' as macros %}
|
||||
{{ macros.menu(nested_pages) }}{% endraw %}</code>
|
||||
</div>
|
||||
{% macro menu(items) %}
|
||||
<ul>
|
||||
{% for name,item in items %}
|
||||
<li>
|
||||
{% if item.url %}
|
||||
<a href="{{ item.url }}">{{ item.title }}</a> : {{ item.description }}
|
||||
{% else %}
|
||||
<span>{{ name }}</span>
|
||||
{% endif %}
|
||||
{% if item._childs %}
|
||||
{% import _self as macros %}
|
||||
{{ macros.menu(item._childs) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% import _self as macros %}
|
||||
{{ macros.menu(nested_pages) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 24 KiB |
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>{% if meta.title %}{{ meta.title }}{% else %}{{ site_title }}{% endif %}</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
{% if meta.description %}
|
||||
<meta name="description" content="{{ meta.description|striptags }}">
|
||||
{% endif %}{% if meta.robots %}
|
||||
<meta name="robots" content="{{ meta.robots }}">
|
||||
{% endif %}
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" type="text/css" />
|
||||
<link rel='stylesheet' href='{{ theme_url }}/styles/style.css' type='text/css'/>
|
||||
<link rel='stylesheet' href='{{ theme_url }}/styles/unslider.css' type='text/css'/>
|
||||
<link rel='stylesheet' href='{{ theme_url }}/styles/unslider-dots.css' type='text/css'/>
|
||||
<script src="{{ theme_url }}/scripts/jquery-3.1.1.min.js"></script>
|
||||
<script src="{{ theme_url }}/scripts/tinynav.min.js"></script>
|
||||
<script src="{{ theme_url }}/scripts/unslider-min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<header id="branding">
|
||||
<div class="container clearfix">
|
||||
<div class="hgroup-wrap clearfix">
|
||||
<section class="hgroup-right">
|
||||
<img src='{{ theme_url }}/images/prva_slika.jpeg'>
|
||||
</section>
|
||||
<hgroup id="site-logo" class="clearfix">
|
||||
<h1 id="site-title"><a href={{ base_url }}>{{ site_title }}</a></h1>
|
||||
<h2 id="site-description">{{ config.site_subtitle }}</h2>
|
||||
</hgroup>
|
||||
</div>
|
||||
</div>
|
||||
<nav id="main-nav" class="clearfix">
|
||||
{{ 'navbar'|content }}
|
||||
</nav>
|
||||
</header>
|
||||
<div id="main" class="clearfix">
|
||||
<div>
|
||||
<div id="primary" class="no-margin-left">
|
||||
<div id="content">
|
||||
<section class="page">
|
||||
<article>
|
||||
<h2>Zadnje novice</h2>
|
||||
{% for page in pages("novice/")|sort_by("date")|reverse if not page.hidden %}
|
||||
<div class="post">
|
||||
<h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
|
||||
<p class="date">{{ page.date_formatted }}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{{ content }}
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div id="secondary">
|
||||
{% for page in pages %}
|
||||
{% if page.id starts with current_page.id|split('/')|slice(0,-1)|join('/') ~ '/sidebars/' %} {# page-specfic sidebars should be placed before global ones #}
|
||||
<aside class="widget">
|
||||
<h3 class="widget-title">{{ page.title }}</h3>
|
||||
{{ page.id|content }}
|
||||
</aside>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for page in pages %}
|
||||
{% if page.id starts with 'sidebars/' %} {# global sidebars #}
|
||||
<aside class="widget">
|
||||
<h3 class="widget-title">{{ page.title }}</h3>
|
||||
{{ page.id|content }}
|
||||
</aside>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="footerarea" class="clearfix">
|
||||
</footer>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#main-nav").children(0).tinyNav({header: 'Navigation'});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document.links).filter(function() {
|
||||
return this.hostname != window.location.hostname;
|
||||
}).attr('target', '_blank');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -37,19 +37,6 @@
|
|||
<nav id="main-nav" class="clearfix">
|
||||
{{ 'navbar'|content }}
|
||||
</nav>
|
||||
{% if current_page.id == 'index' %} {# only show sliders at index page #}
|
||||
<div class="featured-slider" >
|
||||
{{ 'slider'|content }}
|
||||
</div>
|
||||
<script>
|
||||
$('.featured-slider').unslider({
|
||||
animation: 'fade',
|
||||
autoplay: true,
|
||||
nav: false,
|
||||
arrows: false
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
</header>
|
||||
<div id="main" class="clearfix">
|
||||
<div>
|
||||
|
@ -83,14 +70,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<footer id="footerarea" class="clearfix">
|
||||
<div id="site-generator">
|
||||
<div class="container">
|
||||
<div class="copyright">Copyright © 2017 <span>{{ config.site_copyright }}</span>.
|
||||
</div>
|
||||
<div class="footer-right">Theme <a href="https://github.com/xupefei/Travelify">Travelify</a> ported by Paddy Xu.</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script>
|
||||
|
|
|
@ -2409,9 +2409,6 @@ a {
|
|||
|
||||
.hgroup-right img {
|
||||
height: 131px;
|
||||
margin-top: -53px;
|
||||
border-top-right-radius: 5px;
|
||||
margin-bottom: -35px;
|
||||
}
|
||||
|
||||
#site-title a:hover {
|
||||
|
@ -2512,3 +2509,52 @@ blockquote {
|
|||
#controllers a.active {
|
||||
color: #3a73c9;
|
||||
}
|
||||
|
||||
/* Prilagoditve */
|
||||
#site-description {
|
||||
color: #444;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#main-nav a {
|
||||
font-size: 1rem;
|
||||
}
|
||||
#main-nav {
|
||||
background-image: url(../images/temno.png);
|
||||
border: none;
|
||||
}
|
||||
|
||||
header, #main {
|
||||
background-image: url(../images/svetlo.png);
|
||||
}
|
||||
|
||||
header .hgroup-right {
|
||||
margin-top: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
header .hgroup-right img {
|
||||
height: 100%;
|
||||
}
|
||||
header .hgroup-wrap {
|
||||
padding-right: 200px;
|
||||
}
|
||||
|
||||
header .container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 485px) {
|
||||
header .hgroup-wrap {
|
||||
padding-right: 20px;
|
||||
}
|
||||
header .hgroup-right {
|
||||
position: relative;
|
||||
}
|
||||
header .hgroup-right img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
|