Headless Wagtail CMS: Serializing RichText Stream Blocks
Published November 29, 2023
This video features Kalob Taulien at Wagtail CMS 2023 .
Tutorial: https://learnwagtail.com/tutorials/changing-page-display-title/
Wagtail for Beginners Course: https://learnwagtail.com/wagtail-for-beginners/
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. This won't change your actual title field, nor will it effect your templates, this is purely a Wagtail Admin feature.
For more free tutorials: https://learnwagtail.com/tutorials/
Don't forget to subscribe to this channel and follow me on Twitter at https://twitter.com/kalobtaulien
Git Commit: https://github.com/CodingForEverybody/learn-wagtail/commit/6109533ac446884158ea9811f1a34d18071e5ed1
Learn Wagtail from scratch with the official Wagtail for Beginners Course
https://learnwagtail.com/wagtail-for-beginners/
Used in this video: Wagtail 2.5.1, Python 3.7, Django 2.2.2
#Wagtail #Django #Python
Wagtail normally uses a page’s title both in the admin and in templates, but `get_admin_display_title()` lets you change only the label shown in the admin. By overriding this method on a page model—for example, returning `"Homepage is the best"`—the admin display changes while `self.title` and the page’s public title remain unchanged. The method can be applied to one model or generalized across page types, which is useful when clients use different names for content but administrators need a consistent label such as “Blog.”
Summarised automatically from the transcript.
Automatically transcribed, so expect mistakes in names and technical terms.
Alright, hello, welcome to another lesson on learning Wagtail. In this video, we're gonna do something super quick. So you know when you're traversing through your pages and you have your homepage and your about and blog and all these different pages that you have throughout your website and That title, I just gotta refresh that there. And that title that you see in here is the exact same as the title that you see in here. And sometimes. Not very often, but sometimes you want to change what it says just in the admin. Not on the homepage. You don't necessarily want to change what it says when you use self dot title in your templates. You don't want to change this value at all. You just want to change what it looks like in here. And Wagtail
there's a really cool way we can do that. So with my project open, I am just going to open Home models. py and I have a home page here and in here I'm just going to quickly explore some of the source code. So I just jumped to definition here and I'm looking at the Wagtail source code for Wagtail 2. 5. 1 And I'm just gonna keep on scrolling, keep on scrolling, and we're gonna see all sorts of stuff in here. And this is a great way to learn Wagtail, is just open up the source code and read through it a little bit. But there's one in here that caught my attention a couple days ago and I thought I would share it. And it's this one here, get admin display title And basically it just returns the draft title, or if there is no draft title, it returns the regular title.
Well you can totally overwrite this. So I'm just gonna copy that and in my homepage And this is just model specific, so it's only going to work on this one page, but you can you can apply this to every page if you wanted to. So I'm gonna overwrite this with let's move that up. Def getAdmin display title. It takes self because it's in a Python object or a Python class rather, and I'm simply going to say return Homepage is the best. I'm gonna save that. My server has restarted with no problems. And let's refresh this here. Yes, leave the page. And we can see that it still says home page here. And I know that in my templates I can still write
self. title and it will still equate to the word home. But when I open this up, this now says homepage is the best. And so now a place where you might maybe use this is when a client has Maybe a blog. And that blog is generally we just call it a blog. So you're going through your page structure here. Pages, you look at your pages. So you've got your homepage, that's just the display title here. And you have a blog, but maybe the client doesn't call it a blog. Maybe they change the title to be something completely different. Maybe they say our latest news But say a year from now they also have a thousand pages in their Wagtail website and it gets a little bit hard to find that and they have to search for it every time and they would rather just look for the word blog.
Well They can just traverse through here and you could rename that to blog if you wanted to. Or in our case, you could rename homepage to homepage is the best. So that's a quick little Wagtail win if you ever want to customize that. And so just as a quick little reminder, I just jumped a definition. You can also check out the source code at github. com slash wagtail slash wagtail I'm just in Wagtailcore Models. py, and I'm in the page class. And you can just take a look through here if you like and find all sorts of cool things that you can sort of manipulate and edit and change and and use to tweak your website. So I just found this one was actually super useful for a particular client I was working with. And I thought hey I'm gonna share this with the rest of the community.
So, there you have it. Don't forget, if you like these videos, there's plenty more where that comes from, at wagtail. io slash course. You can always share, subscribe, or like this video. And as always, the source code for this entire website, which is verbosely named my website, is available at github. com slash codingforeverybody.
Override the page model’s `get_admin_display_title` method and return the label you want displayed. This changes the title shown in the admin while `self.title` in templates remains unchanged.
Discussed at 1:35Yes. Define `get_admin_display_title` on the specific page model, and the custom label will apply to pages of that model; the method can also be added more broadly if desired.
Discussed at 1:35It can make pages easier for clients to find in the page structure—for example, showing “Blog” in the admin even if the public-facing title is “Our latest news.”
Discussed at 2:22Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.
Published September 19, 2026
Published July 9, 2026
Published May 20, 2026
Published April 16, 2026
Published April 1, 2026
Published March 10, 2026