diff --git a/conf/config.yml.template b/conf/config.yml.template
index 7253676..3df356d 100644
--- a/conf/config.yml.template
+++ b/conf/config.yml.template
@@ -12,7 +12,7 @@ locale: ~ # Your PHP installation might require you to
##
# Theme
#
-theme: default # The name of your custom theme
+theme: __THEME__ # The name of your custom theme
themes_url: ~ # Pico will try to guess the URL to the themes dir of your installation;
# If this fails, override it here. Example: https://example.com/pico/themes/
theme_config: # Additional theme-specific config
diff --git a/config_panel.toml b/config_panel.toml
index 4ea85d1..cb4106f 100644
--- a/config_panel.toml
+++ b/config_panel.toml
@@ -10,4 +10,10 @@ name = "Pico configuration"
ask = "Website title"
type = "string"
help = "Customise the title of your website"
- bind = "site_title:/var/www/pico/config/config.yml"
+ bind = "site_title:/var/www/__APP__/config/config.yml"
+
+ [main.config.theme]
+ ask = "Website theme"
+ choices = ["default", "bitsandpieces", "cutter"]
+ help = "Customise the theme of your website"
+ bind = "theme:/var/www/__APP__/config/config.yml"
diff --git a/manifest.json b/manifest.json
index 75c11e2..8b5233c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -48,6 +48,20 @@
"fr": "Le titre de votre site web"
}
},
+ {
+ "name": "theme",
+ "type": "string",
+ "ask": {
+ "en": "The theme of your website",
+ "fr": "Le theme de votre site web"
+ },
+ "choices": [
+ "default",
+ "bitsandpieces",
+ "cutter"
+ ],
+ "default": "default"
+ },
{
"name": "is_public",
"type": "boolean",
diff --git a/scripts/install b/scripts/install
index e19cf4c..6e6e2c4 100755
--- a/scripts/install
+++ b/scripts/install
@@ -28,6 +28,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
site_title=$YNH_APP_ARG_SITE_TITLE
+theme=$YNH_APP_ARG_SITE_THEME
app=$YNH_APP_INSTANCE_NAME
@@ -50,6 +51,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=site_title --value=$site_title
+ynh_app_setting_set --app=$app --key=theme --value=$theme
#=================================================
# INSTALL DEPENDENCIES
@@ -75,6 +77,9 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
+cp ../sources/plugins $final_path/plugins
+cp ../sources/themes $final_path/themes
+
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
diff --git a/scripts/upgrade b/scripts/upgrade
index 06e70da..13a0daa 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
site_title=$(ynh_app_setting_get --app=$app --key=site_title)
+theme=$(ynh_app_setting_get --app=$app --key=theme)
#=================================================
# CHECK VERSION
diff --git a/sources/plugins/Clutter/Clutter.php b/sources/plugins/Clutter/Clutter.php
new file mode 100755
index 0000000..2013b84
--- /dev/null
+++ b/sources/plugins/Clutter/Clutter.php
@@ -0,0 +1,61 @@
+getPico()->getBaseUrl();
+ $pieces = explode('/', '/' . $string);
+
+ $returnStringParts = [];
+ $aggregate = '';
+
+ $arr2s = '';
+
+ for ($i = 1; $i < count($pieces); $i++) {
+ $arr2s = $arr2s . ',' . $pieces[$i];
+ $aggregate = $aggregate . $pieces[$i] . '/';
+
+ $anchor = sprintf('%s', $baseUrl, $aggregate, $pieces[$i]);
+ //$returnString = $returnString . $anchor . '/';
+ $returnStringParts[] = $anchor;
+ }
+ return implode('/', $returnStringParts);
+ }
+
+ //public function onPageRendering(&$templateName, array &$twigVariables) {
+ public function onPagesDiscovered(&$pages) {
+ $twig = $this->getPico()->getTwig();
+
+ $twig->addFilter(new Twig_SimpleFilter('directoryChain', array($this, 'directoryChain')));
+ $twig->addFilter(new Twig_SimpleFilter('root', array($this, 'root')));
+ $twig->addFilter(new Twig_SimpleFilter('level', array($this, 'level')));
+ $twig->addFilter(new Twig_SimpleFilter('isIndex', array($this, 'isIndex')));
+ }
+
+}
diff --git a/sources/themes/bitsandpieces/LICENSE b/sources/themes/bitsandpieces/LICENSE
new file mode 100755
index 0000000..07236e1
--- /dev/null
+++ b/sources/themes/bitsandpieces/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Fredrik D
+
+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.
diff --git a/sources/themes/bitsandpieces/README.md b/sources/themes/bitsandpieces/README.md
new file mode 100755
index 0000000..6faa2a0
--- /dev/null
+++ b/sources/themes/bitsandpieces/README.md
@@ -0,0 +1,85 @@
+# Bits and Pieces theme for Pico
+
+
+
+I have long searched for a way to store useful bits and pieces for reference; snippets of Javascript, odd CSS selectors, how to exit vim etc. General purpose bins like Evernote where you're supposed to throw everything into it has never really worked for me. It always ends up looking like my desk – messy and disorganized.
+
+For the last couple of years I have stored my reference files as markdown files with front-ends to render them. For a while I have used [Pico CMS](http://picocms.org) as my front-end together with this minimalistic theme I have made.
+
+The theme is really simple and barebone and can easily be customized and extended to suit your needs.
+
+## Getting started
+
+### My setup
+
+My prefered way is to simply run the site locally on my machine. That way it's super fast and I don't have to worry about securing the site, restricting access and such.
+
+### Installation
+
+Download the repository and put the `bitsandpieces` folder in the `themes` folder in Pico and update the config.php with the following settings:
+
+```php
+$config['theme'] = 'bitsandpieces';
+```
+
+### Editing content
+
+I personally edit my references files using texteditors and doesn't use any admin backend or page admin plugin. I have set up an [Alfred](https://www.alfredapp.com) workflow to do a keyworded file search inside my content directory so when I want to edit a page a simply hit `cmd-space` and type `ref ter` which opens the file terminal.md located in the contents folder in my prefered text editor, which at the moment is Typora.
+
+I also keep my reference files as a private git repository on github so I can access and edit them anywhere on any device where I have an internet connection. Much easier than having to fiddle with a webserver to dropbox setup.
+
+## Theme specific guidelines
+
+### Navigation
+
+The theme has currently no sub navigation. Regardles of the folder structure in your content directory all pages will be rendered in a flat list
+
+### Keyboard shortcuts
+Assign keyboard shortcuts to quickly switch between pages. Add the metadata `Shortcut: ` in the YAML header to assign the key to the page. Use `+` to make key combos. [Look at mousetrap documentation to see what you can do](https://craig.is/killing/mice)
+
+```yaml
+---
+Title: Bits and Pieces theme for Pico
+Shortcut: alt+1
+---
+```
+
+The above example will open the Bits and Pieces page when the keys `alt` and `1` keys are pressed simultaneously
+
+### Titles
+
+Do include a level 1 header in your content `# this is a H1`. The title you specify in the front matter is used only for the navigation and does not render with the content.
+
+### Headings
+
+The theme only provide styles for the first three levels of headers and style the remaining headers as bold text. It's my opinion that if you need more than three levels of hierarchy you'd better split the content into different files
+
+### Code snippets
+
+Code highligt are rendered using [highlight.js](https://highlightjs.org). Put the language right after the three backticks to get proper language highlighting. To see what language prefix to use see [highlight.js documentation](http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#language-names-and-aliases).
+
+```markdown
+```html
+