Derive body class for pages
This commit is contained in:
parent
3986b30a64
commit
82f3163ff5
4 changed files with 11 additions and 7 deletions
|
@ -5,9 +5,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>
|
<title>
|
||||||
{% block title %}
|
{% block title %}{% endblock %}
|
||||||
{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
{% block title_suffix %}
|
{% block title_suffix %}
|
||||||
{% wagtail_site as current_site %}
|
{% wagtail_site as current_site %}
|
||||||
{% if current_site and current_site.site_name %}:: {{ current_site.site_name }}{% endif %}
|
{% if current_site and current_site.site_name %}:: {{ current_site.site_name }}{% endif %}
|
||||||
|
|
5
templates/wagtail_base.html
Normal file
5
templates/wagtail_base.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block body_class %}{{ page.body_class }}{% endblock %}
|
||||||
|
|
||||||
|
{% block title %}{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}{% endblock %}
|
|
@ -6,3 +6,7 @@ from wagtail.models import Page
|
||||||
class BasePage(Page):
|
class BasePage(Page):
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def body_class(self):
|
||||||
|
return "page-" + self._meta.db_table.replace("_", "-")
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
{% extends "base.html" %}
|
{% extends "wagtail_base.html" %}
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
{% block body_class %}template-homepage{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue