`a normal article <{filename}/examples/article.rst>`_ and a
`jumbo article <{filename}/examples/jumbo-article.rst>`_.
+`Archived articles`_
+--------------------
+
+It's possible to mark articles and archived by setting the :rst:`:archived:`
+field to :py:`True`. In addition to that, you can display an arbitrary
+formatted block on the article page on top of article contents right below the
+summary. The content of the block is controlled by the
+:py:`M_ARCHIVED_ARTICLE_BADGE` setting, containinig
+:abbr:`reST <reStructuredText>`-formatted markup. The ``{year}`` placeholder,
+if present, is replaced with the article year. If the setting is not present,
+no block is rendered at all. Example setting:
+
+.. code:: py
+
+ M_ARCHIVED_ARTICLE_BADGE = """
+ .. container:: m-note m-warning
+
+ This article is from {year}. **It's old.** Deal with it.
+ """
+
`(Social) meta tags for articles`_
----------------------------------
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-m-10 m-push-m-1 m-nopady">
+ {% if article.archived == 'True' and M_ARCHIVED_ARTICLE_BADGE %}
+ {{ M_ARCHIVED_ARTICLE_BADGE|render_rst|replace('{year}', article.date.year)|indent(8) }}
+ {% endif %}
<!-- content -->
{{ article.content|trim }}
<!-- /content -->
{% macro header() %}{% include "article_header.html" %}{% endmacro %}
{{ header()|indent(6) }}
<div class="m-clearfix-l"></div>
+ {% if article.archived == 'True' and M_ARCHIVED_ARTICLE_BADGE %}
+ {{ M_ARCHIVED_ARTICLE_BADGE|render_rst|replace('{year}', article.date.year)|indent(6) }}
+ {% endif %}
{% if article.content %}
<!-- content -->
{{ article.content|trim }}
-<p>Posted{% if article.authors %} by {% for author in article.authors %}<a href="{{ author.url|format_siteurl|e }}">{{ author|e }}</a>{% endfor %}{% endif %} on <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time> in <a href="{{ article.category.url|format_siteurl|e }}">{{ article.category|e }}</a>.{% if article.modified %} <span class="m-label m-success">updated <time datetime="{{ article.modified.isoformat() }}">{{ article.locale_modified }}</time></span>{% endif %}{% if article.tags %} Tags: {% for tag in article.tags %}<a href="{{ tag.url|format_siteurl|e }}">{{ tag|e }}</a>{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}</p>
+<p>Posted{% if article.authors %} by {% for author in article.authors %}<a href="{{ author.url|format_siteurl|e }}">{{ author|e }}</a>{% endfor %}{% endif %} on <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time> in <a href="{{ article.category.url|format_siteurl|e }}">{{ article.category|e }}</a>.{% if article.modified %} <span class="m-label m-success">updated <time datetime="{{ article.modified.isoformat() }}">{{ article.locale_modified }}</time></span>{% endif %}{% if article.archived == 'True' %} <span class="m-label m-warning">archived</span>{% endif %}{% if article.tags %} Tags: {% for tag in article.tags %}<a href="{{ tag.url|format_siteurl|e }}">{{ tag|e }}</a>{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}</p>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>A jumbo article | A Pelican Blog</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
+ <link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="canonical" href="article-jumbo.html" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation" class="m-navbar-cover">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+ </div>
+ </div>
+</nav></header>
+<main>
+ <article id="m-jumbo">
+ <header>
+ <div id="m-jumbo-image" style="background-image: url('image.jpg');">
+ <div id="m-jumbo-cover">
+ <div class="m-container">
+ <div class="m-row">
+ <div class="m-col-t-12 m-col-s-10 m-push-s-1 m-text-left">Jan 16, 1982</div>
+ </div>
+ <div class="m-row">
+ <div class="m-col-t-12 m-col-s-10 m-push-s-1 m-col-m-8 m-push-m-2">
+ <h1><a href="article-jumbo.html" rel="bookmark" title="Permalink to A jumbo article">A jumbo article</a></h1>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="m-container">
+ <div class="m-row">
+ <div class="m-col-m-10 m-push-m-1 m-nopady">
+ <p>Article content.</p>
+ </div>
+ </div>
+ </div>
+ </header>
+ <div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-m-10 m-push-m-1 m-nopady">
+ <div class="m-note m-warning">
+ This article is from 1982. <strong>It's old.</strong> Deal with it.</div>
+<!-- content -->
+<p>Article content.</p>
+<!-- /content -->
+ </div>
+ </div>
+ </div>
+ <footer class="m-container">
+ <div class="m-row">
+ <div class="m-col-m-10 m-push-m-1 m-nopadb">
+ <p>Posted on <time datetime="1982-01-16T00:00:00+00:00">Jan 16, 1982</time> in <a href="category-misc.html">misc</a>. <span class="m-label m-warning">archived</span></p>
+ </div>
+ </div>
+ </footer>
+ </article>
+ <nav class="m-navpanel m-container">
+ <div class="m-row">
+ <div class="m-col-s-4 m-col-l-2 m-push-s-4 m-push-l-5">
+ <h3>Categories</h3>
+ <ol class="m-block-bar-s">
+ <li><a href="category-misc.html">misc</a></li>
+ </ol>
+ </div>
+ </div>
+ </nav>
+</main>
+</body>
+</html>
--- /dev/null
+A jumbo article
+###############
+
+:date: 1982-01-16
+:cover: image.jpg
+:archived: True
+
+Article content.
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>An article | A Pelican Blog</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
+ <link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="canonical" href="article.html" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+ </div>
+ </div>
+</nav></header>
+<main>
+<div class="m-container">
+ <div class="m-row">
+ <article class="m-col-m-10 m-nopadb">
+ <header>
+ <h1><a href="article.html" rel="bookmark" title="Permalink to An article">
+ <time class="m-date" datetime="1982-01-16T00:00:00+00:00">
+ Jan <span class="m-date-day">16</span> 1982
+ </time>
+ An article
+ </a></h1>
+ <p>Article content.</p>
+ </header>
+ <div class="m-clearfix-l"></div>
+ <div class="m-note m-warning">
+ This article is from 1982. <strong>It's old.</strong> Deal with it.</div>
+<!-- content -->
+<p>Article content.</p>
+<!-- /content -->
+ <footer>
+ <p>Posted on <time datetime="1982-01-16T00:00:00+00:00">Jan 16, 1982</time> in <a href="category-misc.html">misc</a>. <span class="m-label m-warning">archived</span></p>
+ </footer>
+ </article>
+ <nav class="m-navpanel m-col-m-2">
+ <h3>Categories</h3>
+ <ol class="m-block-bar-m">
+ <li><a href="category-misc.html">misc</a></li>
+ </ol>
+ </nav>
+ </div>
+</div>
+</main>
+</body>
+</html>
--- /dev/null
+An article
+##########
+
+:date: 1982-01-16
+:archived: True
+
+Article content.
self.assertEqual(*self.actual_expected_contents('category-a-category.html'))
self.assertEqual(*self.actual_expected_contents('author-the-author.html'))
self.assertEqual(*self.actual_expected_contents('tag-a-tag.html'))
+
+class ArchivedArticle(BlogTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'archived_article', *args, **kwargs)
+
+ def test(self):
+ self.run_pelican({
+ 'M_ARCHIVED_ARTICLE_BADGE': """
+.. container:: m-note m-warning
+
+ This article is from {year}. **It's old.** Deal with it.
+"""
+ })
+
+ self.assertEqual(*self.actual_expected_contents('article.html'))
+ self.assertEqual(*self.actual_expected_contents('article-jumbo.html'))