我已经为 Pelican 创建了自己的主题,并且已经使用它来构建我的网站已有一段时间了。我决定重新开始写博客,所以我现在才向网站添加博客功能。
我创建了自己的blog.html
模板,以我想要的方式呈现内容。我首先从 Pelican 附带的“简单”主题中复制和粘贴代码来帮助我开始,但即使它没有改变,我在'articles_page' is undefined
尝试构建时也会遇到错误。
article_page
变量集从哪里来?我尝试添加到我的pelicanconf.py
文件中,但没有帮助。
{% extends 'base.html' %}
{% block title %}{{ page.title }} — Ricky White{% endblock title %}
{% block content %}
<section class="wrapper">
<div class="container">
<div class="row">
<div class="col">
<ol id="post-list">
{% for article in articles_page.object_list %}
<li><article class="hentry">
<header> <h2 class="entry-title"><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h2> </header>
<footer class="post-info">
<time class="published" datetime="{{ article.date.isoformat() }}"> {{ article.locale_date }} </time>
<address class="vcard author">By
{% for author in article.authors %}
<a class="url fn" href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a>
{% endfor %}
</address>
</footer><!-- /.post-info -->
<div class="entry-content"> {{ article.summary }} </div><!-- /.entry-content -->
</article></li>
{% endfor %}
</ol><!-- /#posts-list -->
{% if articles_page.has_other_pages() %}
{% include 'pagination.html' %}
{% endif %}
</div>
</div>
</div>
</section>
{% endblock content %}