首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在posts或/tag页面下未显示用于摇尾的标记

在posts或/tag页面下未显示用于摇尾的标记
EN

Stack Overflow用户
提问于 2017-03-30 18:29:11
回答 1查看 288关注 0票数 0

我遵循这个指南> started/tutorial.html#tagging-posts

据我所知,我完全按照它编写的指南进行操作,但是在查看单个博客文章时,标记不会加载,标签页也不会显示标签列表。我没有收到任何错误,只是没有出现。

它们在通过链接(如http://0.0.0.0:8000/tags/?tag=lorem )进行搜索时显示。

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-30 19:13:57

我自己一直想办法解决问题。Wagtail需要更新它们的文档,使其更具体,但是下面是在blog/blog_page.html中为我工作的代码

代码语言:javascript
复制
{% 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 %}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43125726

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档