diff --git a/.stignore b/.stignore index c378ca5..4c277bf 100644 --- a/.stignore +++ b/.stignore @@ -1,5 +1,5 @@ -.git -// .gitignore +/.git +/.gitignore // ignorirani fajli, ki jih rabi NextCloud /._sync_504320134e4a.db diff --git a/README.md b/README.md index f8d25f6..148299f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ - # Link do sajta: ``` http://zapatista.kompot.si -``` \ No newline at end of file +``` +[http://zapatista.kompot.si](http://zapatista.kompot.si) \ No newline at end of file diff --git a/assets/image.png b/assets/image.png deleted file mode 100644 index e719621..0000000 Binary files a/assets/image.png and /dev/null differ diff --git a/assets/prva_slika.jpeg b/assets/prva_slika.jpg similarity index 100% rename from assets/prva_slika.jpeg rename to assets/prva_slika.jpg diff --git a/assets/slider/hel.jpg b/assets/slider/hel.jpg deleted file mode 100644 index bf1c312..0000000 Binary files a/assets/slider/hel.jpg and /dev/null differ diff --git a/assets/slider/prva_slika.jpeg b/assets/slider/prva_slika.jpeg deleted file mode 100644 index 03e71fc..0000000 Binary files a/assets/slider/prva_slika.jpeg and /dev/null differ diff --git a/config/config.yml b/config/config.yml index d410e7a..ca6229e 100644 --- a/config/config.yml +++ b/config/config.yml @@ -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 diff --git a/content/index.md b/content/index.md index 66dae8a..95f73f6 100644 --- a/content/index.md +++ b/content/index.md @@ -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Physical LocationURL
content/index.md/
content/sub.md?sub (not accessible, see below)
content/sub/index.md?sub (same as above)
content/sub/page.md?sub/page
content/theme.md?theme (hidden in menu)
content/a/very/long/url.md - ?a/very/long/url - (doesn't exist) -
- -## 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 diff --git a/content/kdosmo.md b/content/kdosmo.md index 8ce3ab1..edb024b 100644 --- a/content/kdosmo.md +++ b/content/kdosmo.md @@ -1,8 +1,6 @@ --- - -## Title: Kdo smo? +Title: Kdo smo? Description: mi smo - --- # Kdo smo? diff --git a/content/navbar.md b/content/navbar.md index 2d2d61e..f8d8aad 100644 --- a/content/navbar.md +++ b/content/navbar.md @@ -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) diff --git a/content/gora.md b/content/novice/gora.md similarity index 97% rename from content/gora.md rename to content/novice/gora.md index 18b3c70..f0a48b6 100644 --- a/content/gora.md +++ b/content/novice/gora.md @@ -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 --- diff --git a/content/slider.md b/content/slider.md deleted file mode 100644 index dc8d223..0000000 --- a/content/slider.md +++ /dev/null @@ -1,5 +0,0 @@ ---- - ---- - - * ![Ladjica](%assets_url%/prva_slika.png) diff --git a/plugins/PicoPagesList/LICENCE.md b/plugins/PicoPagesList/LICENCE.md new file mode 100644 index 0000000..73eeb80 --- /dev/null +++ b/plugins/PicoPagesList/LICENCE.md @@ -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. \ No newline at end of file diff --git a/plugins/PicoPagesList/PicoPagesList.php b/plugins/PicoPagesList/PicoPagesList.php new file mode 100644 index 0000000..1a8b810 --- /dev/null +++ b/plugins/PicoPagesList/PicoPagesList.php @@ -0,0 +1,245 @@ +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 = ''; + return $html; + } +} diff --git a/plugins/PicoPagesList/README.md b/plugins/PicoPagesList/README.md new file mode 100644 index 0000000..f6cfbe3 --- /dev/null +++ b/plugins/PicoPagesList/README.md @@ -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 + +``` + +```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) %} + +{% 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 +``` diff --git a/plugins/PicoPagesList/composer.json b/plugins/PicoPagesList/composer.json new file mode 100644 index 0000000..39beda0 --- /dev/null +++ b/plugins/PicoPagesList/composer.json @@ -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" ] + } +} \ No newline at end of file diff --git a/plugins/PicoPagesList/examples/capture.png b/plugins/PicoPagesList/examples/capture.png new file mode 100644 index 0000000..dcf634a Binary files /dev/null and b/plugins/PicoPagesList/examples/capture.png differ diff --git a/plugins/PicoPagesList/examples/demo.twig b/plugins/PicoPagesList/examples/demo.twig new file mode 100644 index 0000000..423d037 --- /dev/null +++ b/plugins/PicoPagesList/examples/demo.twig @@ -0,0 +1,162 @@ + +
+
+
+
+

Generate a flat navigation using the default page array.

+ {% raw %}{{ pages | navigation }}{% endraw %} +
+ {{ pages | navigation }} +
+
+
+

Generate a nested navigation using the nested array.

+ {% raw %}{{ nested_pages | navigation }}{% endraw %} +
+ {{ nested_pages | navigation }} +
+
+
+

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... +

+ {% raw %}.is-page, .is-directory, .is-current, .is-active, .has-childs ...{% endraw %} +
+
+
+
+

Filtering pages paths with the exclude filter :

+ {% raw %}{{ nested_pages | exclude('PicoPagesList') | navigation }}{% endraw %} +
+ {{ nested_pages | exclude('PicoPagesList') | navigation }} +
+
+
+

Filter the inner pages by using a trailing slash :

+ {% raw %}{{ nested_pages | exclude('PicoPagesList/') | navigation }}{% endraw %} +
+ {{ nested_pages | exclude('PicoPagesList/') | navigation }} +
+
+
+

Filter all pages except the given ones with only, and chain filters :

+ {% raw %}{{ nested_pages | only('PicoPagesList') | exclude('PicoPagesList/sub/bar') | navigation }}{% endraw %} +
+ {{ nested_pages | only('PicoPagesList') | exclude('PicoPagesList/sub/bar') | navigation }} +
+
+
+

Filters can be given multiple paths :

+ {% raw %}{{ nested_pages | only('PicoPagesList/sub', 'index') | navigation }}{% endraw %} +
+ {{ nested_pages | only('PicoPagesList/sub', 'index') | navigation }} +
+
+
+

Custom loop :

+ {% 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 %} + +{% raw %}{% import 'macros.twig' as macros %} +{{ macros.menu(nested_pages) }}{% endraw %} +
+ {% macro menu(items) %} +
    + {% for name,item in items %} +
  • + {% if item.url %} + {{ item.title }} : {{ item.description }} + {% else %} + {{ name }} + {% endif %} + {% if item._childs %} + {% import _self as macros %} + {{ macros.menu(item._childs) }} + {% endif %} +
  • + {% endfor %} +
+ {% endmacro %} + + {% import _self as macros %} + {{ macros.menu(nested_pages) }} +
+
+
\ No newline at end of file diff --git a/themes/Travelify-tr00/images/svetlo.png b/themes/Travelify-tr00/images/svetlo.png new file mode 100644 index 0000000..7909115 Binary files /dev/null and b/themes/Travelify-tr00/images/svetlo.png differ diff --git a/themes/Travelify-tr00/images/temno.png b/themes/Travelify-tr00/images/temno.png new file mode 100644 index 0000000..e2f89bf Binary files /dev/null and b/themes/Travelify-tr00/images/temno.png differ diff --git a/themes/Travelify-tr00/index-novice.twig b/themes/Travelify-tr00/index-novice.twig new file mode 100644 index 0000000..5f915f0 --- /dev/null +++ b/themes/Travelify-tr00/index-novice.twig @@ -0,0 +1,94 @@ + + + + + {% if meta.title %}{{ meta.title }}{% else %}{{ site_title }}{% endif %} + + + {% if meta.description %} + + {% endif %}{% if meta.robots %} + + {% endif %} + + + + + + + + + + + +
+
+
+
+
+ +
+ +
+
+ +
+
+
+
+
+
+
+

Zadnje novice

+ {% for page in pages("novice/")|sort_by("date")|reverse if not page.hidden %} +
+

{{ page.title }}

+

{{ page.date_formatted }}

+
+ {% endfor %} + + {{ content }} +
+
+
+
+
+ {% 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 #} + + {% endif %} + {% endfor %} + {% for page in pages %} + {% if page.id starts with 'sidebars/' %} {# global sidebars #} + + {% endif %} + {% endfor %} +
+
+
+ +
+ + + + diff --git a/themes/Travelify-tr00/index.twig b/themes/Travelify-tr00/index.twig index 86e917f..40a5d0d 100644 --- a/themes/Travelify-tr00/index.twig +++ b/themes/Travelify-tr00/index.twig @@ -37,19 +37,6 @@ - {% if current_page.id == 'index' %} {# only show sliders at index page #} - - - {% endif %}
@@ -83,14 +70,6 @@