0.4.45 page title

This commit is contained in:
SDE
2024-01-06 13:21:05 +03:00
parent 1b6f7aa14d
commit 58c83e2eea
2 changed files with 27 additions and 13 deletions

View File

@@ -148,6 +148,20 @@ class BaseModelViewPage(BaseModel):
class Meta: class Meta:
abstract = True abstract = True
def get_title(self):
if self.seo_title:
return self.seo_title
elif self.title:
return self.title
else:
return self.name
def get_description(self):
if self.seo_description:
return self.seo_description
else:
return self.description
def get_feedback_block(self): def get_feedback_block(self):
blocks = self.get_blocks() blocks = self.get_blocks()
for block in blocks: for block in blocks:

View File

@@ -1,19 +1,19 @@
{% if page.seo_title %} {#{% if page.seo_title %}#}
<title>{{ page.seo_title }}</title> <title>{{ page.get_title }}</title>
{% elif page.title %} {#{% elif page.title %}#}
<title>{{ page.title }}</title> {# <title>{{ page.title }}</title>#}
{% elif page.name %} {#{% elif page.name %}#}
<title>{{ page.name }}</title> {# <title>{{ page.name }}</title>#}
{% endif %} {#{% endif %}#}
{% if page.seo_description %} {% if page.get_description %}
<meta name="description" content="{{ page.seo_description }}"/> <meta name="description" content="{{ page.get_description }}"/>
{% elif page.description %} {#{% elif page.description %}#}
<meta name="description" content="{{ page.description }}"/> {# <meta name="description" content="{{ page.description }}"/>#}
{% endif %} {% endif %}
{% if page.seo_keywords %} {% if page.seo_keywords %}
<meta name="keywords" content="{{ page.seo_keywords }}"/> <meta name="keywords" content="{{ page.seo_keywords }}"/>
{% elif page.description %} {% elif page.get_description %}
<meta name="keywords" content="{{ page.description }}"/> <meta name="keywords" content="{{ page.get_description }}"/>
{% endif %} {% endif %}