1
0
mirror of https://github.com/arsenetar/pelican-red.git synced 2024-11-26 04:29:02 +00:00

Add article template files which now fully render

The article templates now provide for a full article with all the
template data. This completes and closes issue #1.
This commit is contained in:
Andrew Senetar 2013-07-30 15:02:19 -04:00
parent 0d53dc55d4
commit 42f8de158e
2 changed files with 135 additions and 12 deletions

View File

@ -1,12 +1,86 @@
{# Items to include at the bottom of a single article #} {# Items to include at the bottom of a single article #}
<ul class='no-bullet no-margin'>
{# Translations #}
{% import 'translations.html' as translations with context %}
{{ translations.translations_for(article) }}
{# PDF links #} {# PDF links #}
{% if PDF_PROCESSOR %} {% if PDF_GENERATOR %}
<a href="{{ SITEURL }}/pdf/{{ article.slug }}.pdf">PDF</a> <li><a href="{{ SITEURL }}/pdf/{{ article.slug }}.pdf" title="Download PDF"><i class="large icon-newspaper"></i> Download PDF</a>
{% endif %} {% endif %}
{# Copyright notice and link #} {# Copyright notice and link #}
{% if COPYRIGHTS and (COPYRIGHT_ARTICLE or article.copyright) %} {% if COPYRIGHTS and ((COPYRIGHT_ARTICLE and DEFAULT_COPYRIGHT and article.copyright is not defined) or article.copyright) %}
<a href="{{ COPYRIGHTS[article.copyright|default(DEFAULT_COPYRIGHT)][1] }}">{{ COPYRIGHTS[article.copyright|default(DEFAULT_COPYRIGHT)][0] }}</a> {% set copyright = article.copyright|default(DEFAULT_COPYRIGHT) %}
<li>Article content licensed under:
<a href="{{ COPYRIGHTS[copyright][1] }}" title="{{ COPYRIGHTS[copyright][0] }}">
{# Output creative commons icons instead of text #}
{% if 'cc' in copyright %}
<i class="large icon-cc"></i>
<i class="large icon-cc-by"></i>
{% if 'nc' in copyright %}
<i class="large icon-cc-nc"></i>
{% endif %} {% endif %}
{% if 'sa' in copyright %}
<i class="large icon-cc-sa"></i>
{% elif 'nd' in copyright %}
<i class="large icon-cc-nd"></i>
{% endif %}
{% else %}
{{ COPYRIGHTS[copyright][0] }}
{% endif %}
</a>
</li>
{% endif %}
{% if article.metadata.parts_articles %}
<li class="pagination-centered"><ul class="parts pagination">
{% for part_article in article.metadata.parts_articles %}
{% if part_article == article %}
<li class="current"><a title="Current Article">{{ part_article.title }}</a></li>
{% else %}
<li><a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}</a></li>
{% endif %}
{% endfor %}
</ul></li>
{% endif %}
<li class="author-details" itemprop="author" itemscope itemtype="http://schema.org/Person">
{% if article.author.name in AUTHORS %}
{% set props = AUTHORS[article.author.name] %}
{% endif %}
<ul class="vcard brief row">
{% if props and props.vcard %}
<div class="small-4 columns">
{% for key, value in props.vcard if key=='photo' %}
<img src="{{ value }}" class="photo" itemprop="image" />
{% endfor %}
</div>
<div class="small-12 columns">
{% for key, value in props.vcard if key in ['fn', 'email', 'url', 'title', 'org']%}
{% if key == 'fn' %}
<li><a href="{{ SITEURL+'/'+article.author.url }}" itemprop="url"><span class="fn" itemprop="name">{{ value }}</span></a></li>
{% elif key == 'url' %}
<li class="url"><a itemprop="sameAs" href="{{ value }}">{{ value }}</a></li>
{% elif key == 'title' %}
<li class="title" itemprop="jobTitle">{{ value }}</li>
{% elif key == 'org' %}
<li class="org" itemprop="affiliation">{{ value }}</li>
{% else %}
<li class="{{ key }}" itemprop="{{ key }}">{{ value }}</li>
{% endif %}
{% endfor %}
</div>
{% else %}
<li><a class="url" href="{{ SITEURL+'/'+article.author.url }}" itemprop="url"></a><span class="fn" itemprop="name">{{ article.author.name }}</span></a></li>
<li itemprop="affiliation" class="org">{{ SITENAME }}</li>
{% endif %}
</ul>
</li>
<li><ul class="no-bullet no-margin">
{% if article.prev_article %}
<li class="left"><a href="{{ SITEURL }}/{{ article.prev_article.url}}">{{ article.prev_article.title }} (Older)</a></li>
{% endif %}
{% if article.next_article %}
<li class="right"><a href="{{ SITEURL }}/{{ article.next_article.url}}">{{ article.next_article.title }} (Newer)</a></li>
{% endif %}
</ul></li>
{# Comments #} {# Comments #}
{% if ( article.comments == True or ( article.comments is not defined and COMMENTS_ARTICLE == True ) ) and DISQUS_SN %} {% if ( article.comments == True or ( article.comments is not defined and COMMENTS_ARTICLE == True ) ) and DISQUS_SN %}
{% include '_disqus.html' %} {% include '_disqus.html' %}

View File

@ -1,10 +1,59 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}{{ super() }} - {{article.title|title}} {% endblock %} {% block content_image %}
{% block content %} {% if article.image %}
<article> <a class="th" href="{{ SITEURL }}/static/{{article.image}}">
<header><h1>{{ article.title|title }}</h1></header> <img src="{{ SITEURL }}/static/{{ article.image }}"/>
{{ article.content }} </a>
<footer>{{ article.author }}</footer> {% endif %}
</article>
{% include '_article_footer.html' %}
{% endblock %} {% endblock %}
{% block content %}
<article itemscope itemtype="http://schema.org/Article">
{% if article.image %}
<meta itemprop="image" content="{{ SITEURL }}/static/{{ article.image }}"/>
{% endif %}
<meta itemprop="description" content="{{ article.summary|striptags() }}"/>
<meta itemprop="name" content="{{ article.title }}"/>
<meta itemprop="url" content="{{ article.url }}"/>
<meta itemprop="sourceOrganization" content="{{ SITENAME }}"/>
<meta itemprop="inLanguage" content="{{ article.lang|default(DEFAULT_LANG) }}"/>
<meta itemprop="wordCount" content="{{ article.content|striptags()|wordcount() }}" />
<meta itemprop="copyrightHolder" content="{{ COPYRIGHT_HOLDER|default(article.author.name) }}"/>
<div class="article-details">
<span class="published">Published on: <abbr title="{{ article.date.isoformat() }}" itemprop="datePublished">{{ article.locale_date }}</abbr></span>
<span class="category">In <a href="{{ article.category.url }}">{{ article.category.name }}</a></span>
{% if article.modified %}
<span class="modified">Last modified on: <abbr title="{{ article.modified }}" itemprop="dateModified">{{ article.modified }}</abbr></span>
{% endif %}
{% if article.tags %}
<div>
<meta itemprop="keywords" content="{{ article.tags|join(', ') }}"/>
<span><a href="{{ SITEURL }}/tags.html"><i class="icon-tag"></i></a> </span>
<ul class="tag-list">
{% for tag in article.tags %}
<li><a href="{{ SITEURL+'/'+tag.url }}">{{ tag.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
<div itemprop="articleBody">
{{ article.content }}
</div>
<footer class="article_footer">
{% include '_article_footer.html' %}
</footer>
{% endblock %}
</article>
{% block aside %}
{{ super() }}
{% if article.related_posts %}
<h3>Related Posts</h3>
<ul class="no-bullet no-margin">
{% for related_post in article.related_posts %}
<li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}