Blog index template
This commit is contained in:
parent
0ec04d2ce4
commit
e2cbb98e6e
2 changed files with 95 additions and 0 deletions
59
publichealth/home/templates/puput/blog_page.html
Normal file
59
publichealth/home/templates/puput/blog_page.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static i18n wagtailcore_tags wagtailimages_tags puput_tags %}
|
||||
|
||||
{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}
|
||||
|
||||
{% block title %}{% if search_term %}{{ search_term }} | {{ blog_page.title }}{% else %}{{ block.super }}{% endif %}{% endblock title %}
|
||||
{% block meta_title %}{% if search_term %}{% trans 'Entries for' %} {{ search_type }} {{ search_term }}{% else %}{{ block.super }}{% endif %}{% endblock meta_title %}
|
||||
{% block meta_description %}{% if search_term %}{% trans 'Entries for' %} {{ search_type }} {{ search_term }}{% else %}{{ block.super }}{% endif %}{% endblock meta_description %}
|
||||
{% block social_share %}
|
||||
{% image blog_page.header_image fill-800x450 as share_image %}
|
||||
<meta property="og:title" content="{{ blog_page.title }}" />
|
||||
<meta property="og:description" content="{{ blog_page.description }}" />
|
||||
<meta property="og:url" content="{% canonical_url %}" />
|
||||
{% if blog_page.header_image %}
|
||||
<meta property="og:image" content="{% image_url share_image.url %}" />
|
||||
<meta property="og:image:width" content="800" />
|
||||
<meta property="og:image:height" content="450" />
|
||||
<meta name="twitter:image" content="{% image_url share_image.url %}" />
|
||||
{% endif %}
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="{{ blog_page.title }}" />
|
||||
<meta name="twitter:description" content="{{ blog_page.description }}" />
|
||||
{% endblock social_share %}
|
||||
|
||||
{% block content %}
|
||||
<section id="news-page">
|
||||
{% with per_page=blog_page.num_entries_page %}
|
||||
{# 'paginate' tag cannot render dotted variables, so we need to create a context var #}
|
||||
{% paginate per_page entries %}
|
||||
{% if search_term %}
|
||||
<div class="searchTerm">{% trans 'Entries for' %} {{ search_type }} "{{ search_term }}"</div>
|
||||
{% endif %}
|
||||
{% for entry in entries %}
|
||||
<article class="container page-content">
|
||||
{% include 'puput/entry_page_header.html' %}
|
||||
{% if entry.header_image %}
|
||||
<span class="img-responsive">
|
||||
{% image entry.header_image fill-800x240 as header_image %}
|
||||
<img alt="{{ entry.header_image.title }}" src="{{ header_image.url }}">
|
||||
</span>
|
||||
{% endif %}
|
||||
<div class="article">
|
||||
{% if entry.excerpt %}
|
||||
{{ entry.excerpt|richtext }}
|
||||
{% else %}
|
||||
{{ entry.body|richtext|truncatewords_html:70 }}
|
||||
{% endif %}
|
||||
<a class="blog_btn continue" href="{% pageurl entry %}">{% trans 'Continue reading' %} »</a>
|
||||
</div>
|
||||
</article>
|
||||
{% empty %}
|
||||
<span>{% trans 'No results found.' %}</span>
|
||||
{% endfor %}
|
||||
<div class="pagination">
|
||||
{% show_paginator %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
</section>
|
||||
{% endblock content %}
|
36
publichealth/home/templates/puput/entry_page_header.html
Normal file
36
publichealth/home/templates/puput/entry_page_header.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{% load wagtailcore_tags wagtailroutablepage_tags puput_tags %}
|
||||
<header>
|
||||
<h2 class="post_title">
|
||||
<a href="{% pageurl entry %}">{{ entry.title }}</a>
|
||||
</h2>
|
||||
<ul class="links">
|
||||
<li>
|
||||
<i class="fa fa-user"></i>
|
||||
<a href="{% routablepageurl blog_page "entries_by_author" entry.owner.username %}">
|
||||
{{ entry.owner.username }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-calendar"></i>
|
||||
{{ entry.date|date:"DATE_FORMAT" }}
|
||||
</li>
|
||||
{% if entry.categories.count > 0 %}
|
||||
<li>
|
||||
<i class="fa fa-folder-open"></i>
|
||||
{% categories_list entry.categories %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if entry.tags.count > 0 %}
|
||||
<li>
|
||||
<i class="fa fa-tag"></i>
|
||||
{% tags_list blog_page.num_tags_entry_header entry.tags %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if blog_page.disqus_api_secret %}
|
||||
<li>
|
||||
<i class="fa fa-comments"></i>
|
||||
{{ entry.num_comments }}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</header>
|
Loading…
Add table
Reference in a new issue