Skip to content

Commit

Permalink
Tentative fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed May 12, 2016
1 parent fb89f3b commit 775a1fa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
9 changes: 5 additions & 4 deletions djangocms_blog/feeds.py
Expand Up @@ -87,6 +87,7 @@ def items(self, obj=None):


class FBInstantFeed(Rss201rev2Feed):
date_format = '%Y-%m-%dT%H:%M:%S%z'

def rss_attributes(self):
return {
Expand All @@ -104,18 +105,18 @@ def add_root_elements(self, handler):
handler.addQuickElement('category', cat)
if self.feed['feed_copyright'] is not None:
handler.addQuickElement('copyright', self.feed['feed_copyright'])
handler.addQuickElement('lastBuildDate', self.latest_post_date().isoformat())
handler.addQuickElement('lastBuildDate', self.latest_post_date().strftime(self.date_format))
if self.feed['ttl'] is not None:
handler.addQuickElement('ttl', self.feed['ttl'])

def add_item_elements(self, handler, item):
super(FBInstantFeed, self).add_item_elements(handler, item)
if item['author']:
handler.addQuickElement('author', item['author'])
if item['date_mod'] is not None:
handler.addQuickElement('pubDate', item['date'].isoformat())
if item['date_pub'] is not None:
handler.addQuickElement('modDate', item['date'].isoformat())
handler.addQuickElement('pubDate', item['date_pub'].strftime(self.date_format))
if item['date_mod'] is not None:
handler.addQuickElement('modDate', item['date_mod'].strftime(self.date_format))
handler.startElement('description', {})
handler._write('<![CDATA[{0}]]>'.format(h.unescape(force_text(item['abstract']))))
handler.endElement('description')
Expand Down
31 changes: 10 additions & 21 deletions djangocms_blog/templates/djangocms_blog/post_instant_article.html
Expand Up @@ -2,41 +2,30 @@
<!doctype html>
<html lang="{{ post.get_current_language }}" prefix="op: http://media.facebook.com/op#">
<head>
<meta charset="utf-8">
{% block canonical_url %}<link rel="canonical" href="{{ meta.url }}"/>{% endblock canonical_url %}
<meta property="op:markup_version" content="v1.0">
<meta charset="utf-8">
{% block canonical_url %}<link rel="canonical" href="{{ meta.url }}"/>{% endblock canonical_url %}
<meta property="op:markup_version" content="v1.0">
</head>
<body>
<article>
<header>
<h1>{{ post.title }}</h1>

<time class="op-published" datetime="{{ post.date_published.isoformat }}">{{ post.date_published|date:"DATE_FORMAT" }}</time>

<time class="op-modified" dateTime="{{ post.date_modified.isoformat }}">{{ post.date_modified|date:"DATE_FORMAT" }}</time>

<address>
<a {% if og_author_url %}rel="facebook" href="{{ og_author_url }}"{% endif %}>{{ post.get_author_name }}</a>
</address>

<figure>
<img src="{{ meta.image }}" alt="{{ post.main_image.default_alt_text|default:'' }}" />
{% if post.main_image.default_caption %}
<figcaption>{{ post.main_image.default_caption }}</figcaption>{% endif %}
{% if post.main_image.default_caption %}<figcaption>{{ post.main_image.default_caption }}</figcaption>{% endif %}
</figure>

<h3 class="op-kicker">
{{ post.abstract|striptags|safe }}
</h3>

<h3 class="op-kicker">{{ post.abstract|striptags|safe }}</h3>
</header>

{% if post.app_config.use_placeholder %}
<div class="blog-content">{% render_placeholder post.content %}</div>
{% else %}
<div class="blog-content">{% render_model post "post_text" "post_text" %}</div>
{% endif %}

{% if post.app_config.use_placeholder %}
<div class="blog-content">{% render_placeholder post.content %}</div>
{% else %}
<div class="blog-content">{% render_model post "post_text" "post_text" %}</div>
{% endif %}
</article>
</body>
</html>

0 comments on commit 775a1fa

Please sign in to comment.