From d2983eed098fb7e37b6c0406af2e504fee0267cc Mon Sep 17 00:00:00 2001
From: Minecon724 <git@m724.eu>
Date: Wed, 12 Mar 2025 19:26:30 +0100
Subject: [PATCH] Update for page templates

Signed-off-by: Minecon724 <git@m724.eu>
---
 site.yml                     | 14 ++++++++----
 template/index_template.html | 16 ++------------
 template/page_template.html  | 41 ++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 18 deletions(-)
 create mode 100644 template/page_template.html

diff --git a/site.yml b/site.yml
index 6d7c758..9f4adc1 100644
--- a/site.yml
+++ b/site.yml
@@ -4,13 +4,19 @@ baseUrl: https://example.com/blog
 # You'll probably have more than 3, this is just for demonstration
 articlesPerPage: 3
 
-# Whether to apply Pebble templating to posts. Disabled by default
+# Whether to apply Pebble templating to posts.
+# Disabled by default
 templateArticles: true
 
-coolProperty: 1231
+# Whether to render page 1 as separate page, using page template.
+# If false (default), index.html is page 1 and url_to_page(1) links to /index.html
+# If true, /page/1.html is rendered and url_to_page(1) links to /page/1.html
+separateFirstPage: false
+
+coolProperty: hello
 coolerProperty:
   isMap: true
   aList:
     - a value
-    - another value
-    - check out site-config.yml!
\ No newline at end of file
+    - 123
+    - check out site.yml!
\ No newline at end of file
diff --git a/template/index_template.html b/template/index_template.html
index 0a53323..8e2737f 100644
--- a/template/index_template.html
+++ b/template/index_template.html
@@ -20,21 +20,9 @@
         </a>
         {% endfor %}
 
-        {% if not page.isFirstPage %}
-            <p>First page: <a href="{{ url_for('/page/1.html') }}">1 (click to go)</a></p>
-            <p>Previous page: <a href="{{ url_for('/page/' ~ page.previous ~ '.html') }}">{{ page.previous }} (click to go)</a></p>
-        {% else %}
-            <p>This is the first page</p>
-        {% endif %}
+        <p>This is the first page</p>
 
-        <p>This is page <a href="{{ url_for('/page/' ~ page.current ~ '.html') }}">{{ page.current }} (click to go)</a></p>
-
-        {% if not page.isLastPage %}
-            <p>Last page: <a href="{{ url_for('/page/' ~ page.last ~ '.html') }}">{{ page.last }} (click to go)</a></p>
-            <p>Next page: <a href="{{ url_for('/page/' ~ page.next ~ '.html') }}">{{ page.next }} (click to go)</a></p>
-        {% else %}
-            <p>This is the last page</p>
-        {% endif %}
+        <p>Next page: <a href="{{ url_to_page(page.next) }}">{{ page.next }} (click to go)</a></p>
 
         <ul>
             {% for e in site.custom.coolerProperty.aList %}
diff --git a/template/page_template.html b/template/page_template.html
new file mode 100644
index 0000000..f9815aa
--- /dev/null
+++ b/template/page_template.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html lang="en">
+    <head>
+        <meta charset="utf-8">
+        <title>{{ site.name }}</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1" />
+
+        <link rel="stylesheet" href="{{ static('style.css') }}">
+    </head>
+    <body>
+        <h1>{{ site.name }} - page {{ page.current }}</h1>
+
+        {% for article in articles %}
+            <a href="article/{{ article.slug }}.html" class="article-short">
+                <article>
+                    <header>
+                        <p class="title">{{ article.title }}</p>
+                        <p class="description">{{ article.summary }}</p>
+                    </header>
+                </article>
+            </a>
+        {% endfor %}
+
+        {% if not page.isFirstPage %}
+            <p>First page: <a href="{{ url_to_page(1) }}">1 (click to go)</a></p>
+            <p>Previous page: <a href="{{ url_to_page(page.previous) }}">{{ page.previous }} (click to go)</a></p>
+        {% else %}
+            <p>This is the first page</p>
+        {% endif %}
+
+        <p><strong>This is page {{ page.current }}</strong></p>
+
+        {% if not page.isLastPage %}
+            <p>Next page: <a href="{{ url_to_page(page.next) }}">{{ page.next }} (click to go)</a></p>
+            <p>Last page: <a href="{{ url_to_page(page.last) }}">{{ page.last }} (click to go)</a></p>
+        {% else %}
+            <p>This is the last page</p>
+        {% endif %}
+
+    </body>
+</html>
\ No newline at end of file