I am using aldryn-newsblog, and would like to dynamically generate facebook og-meta tags when displaying a blog post.
I figured out how to include these meta tags in my base_root.html, the question is how can I include a set of default og-meta tags, for the none blog post sites?
This is what I have tried. For now only the else-statement is taking place..
{% if article.detail_view %}
<!-- Open Graph data -->
<meta property="og:title" content="{{ article.title }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ article.get_absolute_url }}" />
<meta property="og:image" content="{{ article.featured_image.image }}" />
<meta property="og:description" content="{{ article.meta_description }}" />
<meta property="og:site_name" content="Ukulelespill" />
<meta property="article:published_time" content="{{ article.publishing_date|date:'d N Y' }}" />
<meta property="article:tag" content="{{ article.meta_keywords }}" />
{% else %}
<meta property="og:title" content="Test, Test and Test" />
<meta property="og:url" content="www.test.com" />
<meta property="og:image" content="/img/img.jpg" />
<meta property="og:description" content="Test, Test and Test" />
<meta property="og:site_name" content="Test" />
<meta property="article:tag" content="Test, Test, Test" />
{% endif %}
Aucun commentaire:
Enregistrer un commentaire