我遵循这个指南> started/tutorial.html#tagging-posts
据我所知,我完全按照它编写的指南进行操作,但是在查看单个博客文章时,标记不会加载,标签页也不会显示标签列表。我没有收到任何错误,只是没有出现。
它们在通过链接(如http://0.0.0.0:8000/tags/?tag=lorem )进行搜索时显示。
谢谢。
发布于 2017-03-30 19:13:57
我自己一直想办法解决问题。Wagtail需要更新它们的文档,使其更具体,但是下面是在blog/blog_page.html中为我工作的代码
{% extends "base.html" %}
{% load wagtailcore_tags wagtailimages_tags %}
{% block body_class %}template-blogpage{% endblock %}
{% block content %}
<h1>{{ page.title }}</h1>
<p class="meta">{{ page.date }}</p>
{% with categories=page.categories.all %}
{% if categories %}
<h3>Posted in:</h3>
<ul>
{% for category in categories %}
<li style="display: inline">
{% image category.icon fill-32x32 style="vertical-align: middle" %}
{{ category.name }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% if page.tags.all.count %}
<div class="tags">
<h3>Tags</h3>
{% for tag in page.tags.all %}
<a href="{% slugurl 'tags' %}?tag={{ tag }}"><button type="button">{{ tag }}<$
{% endfor %}
</div>
{% endif %}
<div class="intro">{{ page.intro }}</div>
{{ page.body|richtext }}
{% for item in page.gallery_images.all %}
<div style="float: left; margin: 10px">
{% image item.image fill-320x240 %}
<p>{{ item.caption }}</p>
</div>
{% endfor %}
<p><a href="{{ page.get_parent.url }}">Return to blog</a></p>
{% endblock %}https://stackoverflow.com/questions/43125726
复制相似问题