Update for page templates
Signed-off-by: Minecon724 <git@m724.eu>
This commit is contained in:
parent
645a91aa17
commit
d2983eed09
3 changed files with 53 additions and 18 deletions
14
site.yml
14
site.yml
|
@ -4,13 +4,19 @@ baseUrl: https://example.com/blog
|
||||||
# You'll probably have more than 3, this is just for demonstration
|
# You'll probably have more than 3, this is just for demonstration
|
||||||
articlesPerPage: 3
|
articlesPerPage: 3
|
||||||
|
|
||||||
# Whether to apply Pebble templating to posts. Disabled by default
|
# Whether to apply Pebble templating to posts.
|
||||||
|
# Disabled by default
|
||||||
templateArticles: true
|
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:
|
coolerProperty:
|
||||||
isMap: true
|
isMap: true
|
||||||
aList:
|
aList:
|
||||||
- a value
|
- a value
|
||||||
- another value
|
- 123
|
||||||
- check out site-config.yml!
|
- check out site.yml!
|
|
@ -20,21 +20,9 @@
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if not page.isFirstPage %}
|
<p>This is the first page</p>
|
||||||
<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 page <a href="{{ url_for('/page/' ~ page.current ~ '.html') }}">{{ page.current }} (click to go)</a></p>
|
<p>Next page: <a href="{{ url_to_page(page.next) }}">{{ page.next }} (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 %}
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{% for e in site.custom.coolerProperty.aList %}
|
{% for e in site.custom.coolerProperty.aList %}
|
||||||
|
|
41
template/page_template.html
Normal file
41
template/page_template.html
Normal file
|
@ -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>
|
Loading…
Add table
Reference in a new issue