Blog

To the settings file we need to add the default templates for both blog types


BLOG = {     "blog":"blog",     "blogpost":"blog_post",     "blogtag":"blog_tag"}


Then we just make a blog on the admin page.


On any page use {{blogs}} to get a list of available blogs, for example if your blog is called my first blog, to get a list of blog posts for that blog {{blogs.my_first_blog.get_posts}} will retrieve all the posts for the blog. 


Templates

Blog

The blog extends a normal page, all a blog does is extend the functionality of a  page.

We get a list of all the blogs available for the page. A single page can have multiple pages reference it. Most of the time it will be just one blog, but we'll be dynamic.


{% for blog in page.get_blogs %}    <h2>{{blog.title}}</h2>    <ul>       {% for post in blog.get_posts %}{% with post.page.data as data %}       <li>           <a href="{{post.page.get_url}}">{{post.title}}</a>       </li>       {% endwith %}{% endfor %}    </ul> {% endfor %} 


Instead of getting all the blog posts we can also get the pinned posts. By using 

blog.get_featured

instead of 

blog.get_posts



Blog Post

Blog post page...

To make it simple we only add the request the blog post at the top of the page.


{% with page.get_blogpost as post %}... the page content ...{% endwith %}


To retrieve data from related blog page 

  {% with page.get_blogpost.get_related.0 as related %}{% with related.page.data as data  %} <h3>{{related.title}}</h3> <img  src="{{data.post_image.image_url_m}}" >{% endwith %}{% endwith %}