【问题标题】:Django CMS app-hook - how to set title?Django CMS app-hook - 如何设置标题?
【发布时间】:2014-09-25 23:57:12
【问题描述】:

我有适用于我的 Django CMS 3.0.3 的 app-hook,并正在寻找正确的解决方案来为我的 app-hook 页面设置元标题。

现在我正在这样做:在我的基本模板中:

{% load cms_tags sekizai_tags menu_tags staticfiles %}
<html>
<head>
    {% block head %}
        <title>{% page_attribute 'page_title' %}</title>
        <meta name="description" content="{% page_attribute 'meta_description' %}">
    {% endblock head %}
    ...

在我的 app-hook 模板中,我像这样覆盖了这个 block head

{% block head %}
    <title>{{ title }}</title>
{% endblock head %}

这是一个正确的解决方案吗?也许我应该在我的 app-hook 视图中以某种方式更改属性 page_title

【问题讨论】:

    标签: django django-cms


    【解决方案1】:

    你可以在那里找到答案:Django CMS Page Title Doesn't Render

    看起来你做的差不多,所以我想这是最好的解决方案

    【讨论】:

      猜你喜欢
      • 2012-03-04
      • 2020-07-16
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-21
      相关资源
      最近更新 更多