Skip to content

Commit 363a425

Browse files
committed
Adds introduction field for blog index
1 parent 0120177 commit 363a425

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 5.2.5 on 2025-10-22 08:36
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("blog", "0029_relatedblogpage"),
9+
]
10+
11+
operations = [
12+
migrations.AlterField(
13+
model_name="blogindexpage",
14+
name="introduction",
15+
field=models.TextField(blank=True),
16+
),
17+
]

tbx/blog/models.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,16 @@
3737

3838
class BlogIndexPage(BasePage):
3939
template = "patterns/pages/blog/blog_listing.html"
40-
4140
subpage_types = ["BlogPage"]
4241

42+
introduction = models.TextField(
43+
blank=True,
44+
)
45+
46+
content_panels = BasePage.content_panels + [
47+
FieldPanel("introduction"),
48+
]
49+
4350
@cached_property
4451
def taxonomy_slugs(self):
4552
services = Service.objects.values_list("slug", flat=True)

tbx/project_styleguide/templates/patterns/molecules/title-filters/title-filters.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
<h1 class="heading heading--mega">{{ item.title }}</h1>
66
</div>
77

8+
{% if introduction %}
9+
<div class="">
10+
<p>{{ introduction|linebreaksbr }}</p>
11+
</div>
12+
{% endif %}
13+
814
{% if tags and not hide_tags %}
915
<div class="title-filters__tags">
1016
<div class="tags">

tbx/project_styleguide/templates/patterns/pages/blog/blog_listing.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
{% block content %}
1212
<div class="grid grid--spacer-large">
13-
{% include "patterns/molecules/title-filters/title-filters.html" with item=page tags=tags %}
13+
14+
{% include "patterns/molecules/title-filters/title-filters.html" with item=page tags=tags introduction=page.introduction %}
1415

1516
<ul class="page-listing page-listing--blog">
1617
{% for post in blog_posts %}

0 commit comments

Comments
 (0)