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.

Code & steps

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:

Happy coding!

Sign up for our newsletter

Get notified about new lessons :)