Il template blog.html mostra l'elenco dei post creati dal backoffice.; per ognuno si possono visualizzare foto, data, titolo, estratto breve e link.
Di default vengono mostrati 8 post per pagina. next_page e previous_page per creare la paginazione Ad esempio:
{% for post in posts %} <img src="{{post. ext_img}}"/> <h2> {{ post.title }} </h2> {{ post.ts.sec | date("F jS \\a\\t g:ia", 'Europe/Rome') }} <p>{{ post.extract }}</p> <a href="{{ postUrl(post) }}" class="btn btn-primary"> Visualizza Post </a> {% endfor %}
Per ottenere il link di un post si utilizza la funzione postUrl:
<a href="{{ postUrl(post) }}" class="btn btn-primary"> Visualizza Post </a>
Utilizzo della paginazione
{% if previous_page | length > 1 %} <a href="{{ previous_page }}">Precedente</a> {% endif %} {% if next_page | length > 1 %} <a href="{{ next_page }}">Successiva</a> {% endif %}
Commenti