diff --git a/system/Controllers/PageController.php b/system/Controllers/PageController.php
index 42d5f64..23a8325 100644
--- a/system/Controllers/PageController.php
+++ b/system/Controllers/PageController.php
@@ -33,6 +33,7 @@ class PageController extends Controller
$item = false;
$home = false;
$breadcrumb = false;
+ $currentpage = false;
$pathToContent = $this->settings['rootPath'] . $this->settings['contentFolder'];
$cache = new WriteCache();
$uri = $request->getUri()->withUserInfo('');
@@ -112,6 +113,35 @@ class PageController extends Controller
# use the structure as navigation if there is no difference
$navigation = $structure;
}
+
+ # start pagination
+ if(isset($args['params']))
+ {
+ $argSegments = explode("/", $args['params']);
+
+ # check if the last url segment is a number
+ $pageNumber = array_pop($argSegments);
+ if(is_numeric($pageNumber) && $pageNumber < 10000)
+ {
+ # then check if the segment before the page is a "p" that indicates a paginator
+ $pageIndicator = array_pop($argSegments);
+ if($pageIndicator == "p")
+ {
+ # use page number as current page variable
+ $currentpage = $pageNumber;
+
+ # set empty args for startpage
+ $args = [];
+
+ # if there are still params
+ if(!empty($argSegments))
+ {
+ # add them to the args again
+ $args['params'] = implode("/", $argSegments);
+ }
+ }
+ }
+ }
# if the user is on startpage
$home = false;
@@ -317,7 +347,8 @@ class PageController extends Controller
'base_url' => $base_url,
'image' => $firstImage,
'logo' => $logo,
- 'favicon' => $favicon
+ 'favicon' => $favicon,
+ 'currentpage' => $currentpage
]);
}
diff --git a/themes/cyanine/blog.twig b/themes/cyanine/blog.twig
new file mode 100644
index 0000000..406b07b
--- /dev/null
+++ b/themes/cyanine/blog.twig
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+ {% if settings.themes.cyanine.blogintro %}
+
+
+
+ {{ content }}
+
+
+ {% endif %}
+
+ {% set pagelist = getPageList(navigation, settings.themes.cyanine.blogfolder, base_url) %}
+ {% set pages = ( pagelist.folderContent|length / 2)|round(0, 'ceil') %}
+ {% set currentpage = currentpage ? currentpage : 1 %}
+ {% set currentposts = (currentpage - 1) * 2 %}
+
+
+
+ {% for element in pagelist.folderContent|slice(currentposts, 2) %}
+
+ {% set post = getPageMeta(settings, element) %}
+ {% set date = element.order[0:4] ~ '-' ~ element.order[4:2] ~ '-' ~ element.order[6:2] %}
+
+ -
+
+
{{ post.meta.description }}
+
+
+ {% endfor %}
+
+ {% if pages > 1 %}
+
+ Page:
+ {% for i in 1 .. pages %}
+ {% if i == currentpage %}
+ {{i}}
+ {% else %}
+ {{i}}
+ {% endif %}
+ {% endfor %}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/themes/cyanine/cyanine.yaml b/themes/cyanine/cyanine.yaml
index 4346854..561d861 100644
--- a/themes/cyanine/cyanine.yaml
+++ b/themes/cyanine/cyanine.yaml
@@ -26,9 +26,28 @@ forms:
large: Large
full: Full Width
+ blog:
+ type: checkbox
+ checkboxlabel: Activate a List of Posts on Homepage
+
+ blogdetails:
+ type: fieldset
+ legend: Configure List of Posts
+ fields:
+
+ blogintro:
+ type: checkbox
+ label: Intro Page
+ checkboxlabel: Show the content of the homepage before the list of posts
+
+ blogfolder:
+ type: text
+ label: Enter the folder path with the posts
+ placeholder: /blog
+
landingpage:
type: checkbox
- checkboxlabel: Activate a landingpage
+ checkboxlabel: Activate a Landing Page on Homepage
landingpageIntro:
type: fieldset
diff --git a/themes/cyanine/index.twig b/themes/cyanine/index.twig
index 0915e48..f38cc05 100644
--- a/themes/cyanine/index.twig
+++ b/themes/cyanine/index.twig
@@ -7,6 +7,10 @@
{% if home and settings.themes.cyanine.landingpage %}
{% include 'home.twig' %}
+
+ {% elseif home and settings.themes.cyanine.blog %}
+
+ {% include 'blog.twig' %}
{% else %}
diff --git a/themes/cyanine/layout.twig b/themes/cyanine/layout.twig
index 5f5154e..0bd038e 100644
--- a/themes/cyanine/layout.twig
+++ b/themes/cyanine/layout.twig
@@ -51,7 +51,7 @@
grid-template-columns: 25% 75%;
}
.grid-main{
- max-width: 56rem;
+ max-width: 48rem;
margin: 0 auto;
}
}
@@ -64,7 +64,7 @@
.grid-main{
padding-left: 4rem;
padding-right: 4rem;
- margin: auto;
+ margin: 0 auto;
}
}
{% else %}
diff --git a/themes/cyanine/partials/posts.twig b/themes/cyanine/partials/posts.twig
index 27e0beb..5280cf8 100644
--- a/themes/cyanine/partials/posts.twig
+++ b/themes/cyanine/partials/posts.twig
@@ -1,6 +1,10 @@
+{% set pages = ( item.folderContent|length / 2)|round(0, 'ceil') %}
+{% set currentpage = currentpage ? currentpage : 1 %}
+{% set currentposts = (currentpage - 1) * 2 %}
+
- {% for element in item.folderContent %}
+ {% for element in item.folderContent|slice(currentposts, 2) %}
{% set post = getPageMeta(settings, element) %}
{% set date = element.order[0:4] ~ '-' ~ element.order[4:2] ~ '-' ~ element.order[6:2] %}
@@ -15,4 +19,17 @@
{% endfor %}
+ {% if pages > 1 %}
+
+ Page:
+ {% for i in 1 .. pages %}
+ {% if i == currentpage %}
+ {{i}}
+ {% else %}
+ {{i}}
+ {% endif %}
+ {% endfor %}
+
+ {% endif %}
+
\ No newline at end of file