Creating a template for blog page
Creating list of blog articles on a blog page is just a matter of looping through articles in this blog. On blog page, in addition to ordinary page object available on every page, there is also a blog object available giving you access to all properties related this blog and all articles associated with this blog.
<html> <head> <title>{{ page.title }}</title> {% stylesheet_link "style.css" %} {{ blog.rss_link }} </head> <body> <h1>Welcome to my Blog!</h1> {% for article in blog.articles %} <h2>{{ article.title }}</h2> <p class="article_date"> Created on {{ article.created_at | date : "%d.%m.%Y" }} by {{ article.author.name }} </p> <p>{{ article.excerpt }} | <a href="{{ article.url }}">Read full article...</a></p> {% endfor %} <hr /> <a href="{{ blog.rss_url }}">Subscribe to RSS feed</a> </body> </html>
- Basics
- Variables
- Filters
- Components
- Localization
- Keyboard shortcuts
- Objects
- Article
- Asset
- Blog
- Comment
- Element
- Language
- Mediaset
- Menu item
- Page
- Person
- Site
- Tag
- Data
- Tags
- addbutton
- assign
- blogcontext
- case
- capture
- commentform
- content
- contentblock
- cycle
- editable
- elementscontext
- for
- grouped
- if
- ifchanged
- image
- include
- load
- login
- loginblock
- menuadd
- menubtn
- menulink
- reorder
- rss_link
- stylesheet_link
- unless
- xcontent
- Examples
- Creating a navigation menu
- Creating language selection
- Blog page example
- Blog article example
- Complete page example
- Breadcrumbs
- Standard theme definition
- Elements listing
- Element page
- Components