如何在模板中引用我网站的标题?
How do I reference my site's title in a template?
我正在创建一个 Wagtail 网站。在管理部分,我转到设置 >> 站点 >> 本地主机,并将 "Site name" 设置为 "My first Wagtail site."
如何使用 Django 代码在模板中显示网站标题?
要使用的标签是:
{{ request.site.site_name }}
旧版本
<h1>Welcome to the {{ request.site.site_name }} website!</h1>
新版本
{% load wagtailcore_tags %}
{% wagtail_site as current_site %}
<h1>Welcome to the {{ current_site.site_name }} website!</h1>
参考:https://docs.wagtail.io/en/stable/releases/2.9.html#upgrade-considerations
我正在创建一个 Wagtail 网站。在管理部分,我转到设置 >> 站点 >> 本地主机,并将 "Site name" 设置为 "My first Wagtail site."
如何使用 Django 代码在模板中显示网站标题?
要使用的标签是:
{{ request.site.site_name }}
旧版本
<h1>Welcome to the {{ request.site.site_name }} website!</h1>
新版本
{% load wagtailcore_tags %}
{% wagtail_site as current_site %}
<h1>Welcome to the {{ current_site.site_name }} website!</h1>
参考:https://docs.wagtail.io/en/stable/releases/2.9.html#upgrade-considerations