New Wagtail Course! 🥳 The Ultimate Wagtail Developers Course

Tutorial Wagtail Version: 2.x

Changing the Page Display Title

In the Wagtail Admin, we can change what the Pages are called in the Wagtail Page Explorer. This isn't a super popular feature, but it's good to know that this is possible.

Let's just dive right into this. It's a simple 2-liner, but it can pack a punch. Check it out!

``` class HomePage(Page): # .. Fields here def get_admin_display_title(self): return "Custom Home Page Title" ```

All this is doing is changing the default get_admin_display_title()

The default for this method is to return a draft title, if there is one, or return the regular page title. Here's what it normally looks like:

``` def get_admin_display_title(self): return self.draft_title or self.title ```

Like most things in Wagtail, it's ultra simple. And that's just one of the things that makes Wagtail such an amazing content management system: no crazy bloat.

The Git Commit

Need a refresher, or just want to copy and paste some code? The Learn Wagtail repo is a good place to start! And this particular commit can be found here: https://github.com/CodingForEverybody/learn-wagtail/commit/6109533ac446884158ea9811f1a34d18071e5ed1

Happy coding!

Related tutorials

Headless CMS: Exposing Custom Page Fields to the v2 API

Posted on

In the last lesson we enabled Wagtails v2 API but we didn't have access to our custom fields.. yet! In this lesson we'll learn how in just 4 lines of code we can make a custom Wagtail Page field show up in our API. And it only gets easier from there.

View lesson, Headless CMS: Exposing Custom Page Fields to the v2 API

Getting Child Page Properties From a Subclassed Page

Posted on

In Wagtail, and just like in Django, you can subclass classes. In this lesson, we're subclassing a Wagtail Page into 2 child pages. But when we query for all the parent classes, we're also given the child classes in the QuerySet, and the data is somewhat inconsistent because child classes can have unique fields that differ from their parents and siblings.

View lesson, Getting Child Page Properties From a Subclassed Page

Adding a Banner (Part 1)

Posted on

Every modern website has a banner. Often it comes with a title, subtitle, an image and an optional call to action button. In this tutorial we're going to add all 4 of those to our Home Page. Includes:

View lesson, Adding a Banner (Part 1)

Customizing Default Property Values

Posted on

In this tutorial we are going to learn how to customize default Wagtail Page properties by changing the default help text and field verbose names. We'll also learn how to set a new default field value when you create a new Wagtail Page.

View lesson, Customizing Default Property Values

The Ultimate Wagtail Developers Course

This course covers everything from basic installation to advanced features like custom blocks and API integration, it's perfect for developers looking to enhance their skills with this powerful CMS.

Ultimate Wagtail Developers Course Logo