如何让夹层侧边栏自动填充博客文章

How to get mezzanine sidebar to autopopulate for blogposts

我有一个博客 运行 夹层,我无法让右侧栏在博客 post 之后自动填充有关博客 post 的信息,例如作者,标签等。唯一能让它显示的方法是手动编辑 base.html 文件并为每个字段添加一个小部件。没有办法自动执行此操作吗?

再次感谢。

默认情况下,夹层包含类似于您所要求的内容,即 filter_panel.html 模板。这是博客应用程序使用的模板。在您使用的任何模板中,将此模板包含在 right_panel 块中,例如:

{% block right_panel %}
{% include "blog/includes/filter_panel.html" %}
{% endblock %}

如果您只是使用 base.html,您可以覆盖 right_panel 块,只需将其替换为上面的 includes 标记即可。

希望对您有所帮助!