# Wagtail in the News Room - Sævar Öfjörð Magnússon & Arnar Tumi Þorsteinsson

Source: https://djangotv.com/videos/wagtail-space-nl/2022/wagtail-in-the-news-room-svar-ofjor-magnusson-arnar-tumi-orsteinsson-wagtail-space-nl-2022/
Date: 2022-06-30
Speakers: Speaker 1, Speaker 2, Speaker 3, Speaker 4, Speaker 5, Speaker 6

## Summary

News organisations publish constantly under pressure, so manually arranging StreamField content creates stale pages, duplication and unnecessary work. The presenters describe a Wagtail approach in which custom template tags query articles by category, track what has already appeared, and automatically fill flexible layouts without editors selecting every item. They also show integrations for inexpensive Cloudflare video streaming, custom image filters for watermarks and colour overlays, Icelandic spell-checking, and ad-zone management through an API. Their sites contain hundreds of thousands of pages and images; Elasticsearch helps editors search them, while category-based page structures keep large archives manageable.

## Transcript

### [00:03] Wagtail for News Organizations

**Speaker 1:** [00:03] My name is Saivar.

**Speaker 2:** [00:05] And I'm Timmy.

**Speaker 1:** [00:06] We are with Overcast in Iceland. We've been building Wagtail sites for Since version nine 0. 6 or 8 or something. So it's been while. We've had had with Wactev. We wanted to show you what we've been doing with news sites specifically in Iceland. Some of our clients are news organisations so and they are a bit special in some ways. So we just want to share our experience with working with them. Yeah this involves ads, so sorry about that. We're sorry about that.

[00:52] So news organizations they are Like I said, bit different from our regular clients. They are really like fast moving, always reacting to like events and news in our society and what's going on in the discourse. They are usually working under a lot of pressure and they're also usually understaffed and Have no budget really. So yeah, the and also in Iceland the journalism landscape is still kind of behind, for example, Europe and the US because Print media is still quite big in Iceland, so they're still kind of trying to figure out how they how they should be moving to

[01:38] You know online news To us, Wagtail is of course the favorite tool to build websites, so that's what we propose to our prospective clients. even if they're news sites or not. In the world of journalism specifically, Django is of course originated from Two developers had a newspaper called Lawrence Journal World. That was Adrian Holobati and Simon Willison. Yeah, the rest is of course history and the reason we're here today. Django specifically describes itself as the web framework for perfectionists with deadlines.

### [02:25] Newsroom Scale and Content Pressure

**Speaker 1:** [02:25] Yeah, perfect for news organizations. So Yeah, we run websites for three organizations in Iceland that have news sites, some of them more than one. And yeah, we just wanted to present with you with some challenges and some of the solutions that we've come up with to accommodate them. So one of the challenges is that The frequency of new content, it's just constant. You know how it is with news. It's just you know it's constantly a storm of news hitting you So we have content creators

[03:10] that are writing like multiple pieces of articles every day and multiple reporters. Here are two screenshots from two of our clients. So they have like 170 or 160,000 pages. One of them has 356,000 images, 11,000 documents, 12,000 almost. So it's a lot of content to work with. And most of it It's only read like for one day or one week and then it's just archived really never to be seen again. And so, yeah, these journalists are really under pressure to deliver these news fast and reliably. So

### [03:56] Automated News Layouts

**Speaker 1:** [03:56] Some approaches that we have had before with building sites in Blacktail is build a layout using stream fields. And then you know adding content as stream blocks or whatever, you know what I mean? Linking content into the blocks manually. This is not an option in this environment because They just don't have the time to do it and it's error prone and they might forget something up there and two people are working on it at the same time and something gets left out and yeah, so it's error prone.

**Speaker 2:** [04:32] Someone has a breaking news and then the next guy just goes over it.

**Speaker 1:** [04:35] Yeah exactly. And also because we always have something new being reported, caching is kind of a problem because you know you don't want to have an old version of your of your site online. But we still wanted to have the flexibility of building the layouts in the stream field so Yeah, so that presented kind of a problem for us, how we would approach this. And we still wanted to allow the content to just fro flow three freely through the page and not have the editors manually linking content or selecting something from clicking buttons. The sections of the site, possibly sections within a front page or a category page.

[05:24] Would have to be scoped to their respective categories. Subsections of the website should behave exactly the same. So And finally, articles should not be displayed twice in the same page, of course. So the solution that we came up with was We use a set of kind of custom template tags that query for news items. So each block knows how many articles it wants to render. It can take into account if it should render a specific category or if it should highlight a specific item.

[06:11] And we do all this. We fetch the news, we do the bookkeeping, figure out what should be excluded because it has been used before, if it's the right category, etc. In the end, each block knows how many which items it should display and we know which items this block would display, so we will exclude them in later. part of the rendering of the page. So we still have the flexible layout building And we don't need to like manually add the content. It's just you just create the article and you forget it.

**Speaker 2:** [06:52] We'll show you a little bit about this.

### [06:54] Cloudflare Video Streaming

**Speaker 1:** [06:54] Yeah, we'll have a short demo for this at the end. Another problem some of our news site clients have is that they stream a lot of videos. So Of course streaming videos is extremely expensive if we use for example one of the available packages or most of the available packages for Wagtail to store media, we would have to store it in like S3 or on the server or whatever. This becomes really expensive really fast. Of course you could put your CDN in front of it, but that's still expensive. So what we

[07:40] In our research we found out that Cloudflare has the best prices for video streaming in the industry. So I think it's

**Speaker 2:** [07:50] Yeah, it's like ten times

**Speaker 1:** [07:52] Yeah, it's like a factor of ten times cheaper. They also will include a ready-to-use video player out of the box. So what we developed was a solution in it's like a small wagtail package that we developed where you can upload a video directly to the back end, but it will bypass all uploads mechanism mechanisms in Wagtail and we'll just upload directly to Cloudflare, receive a token back. We will use that to of course render the player that Cloudflare provides. So that was Yeah, really good solution of that problem.

### [08:32] Custom Image Filters

**Speaker 2:** [08:32] Yeah. Then there's a little bit about the image filters. When we when we were starting out with these new sets we had you know not much we didn't know much about the image filters how they worked but we were forced to do some work on them because the news websites they wanted their images to be shared on social media but when they were shared on social media they also got stolen from other websites. So what they wanted was to bake in their logo into the share images. And then you know when we had finished that

[09:18] they wanted to do more about more stuff with the images like color overlays and stuff like that so that it would be color overlaid when it like it's Facebook or some other place. So we are now able to just add new filters to the existing image tag so we can get like for this one the watermark then we have a an image just as a general site setting. So every time an image has to be rendered with a watermark, it will just fetch that image, calculate the size you know respectable to the image, and then pay it in

[10:03] so that we have a rendition basically that has this baked in. Another example was When they had like opinion pieces, they wanted them to be like colorized by the type of like a category of opinion pieces. So then they could, you know, have the authors colorized and then that image would be shared with the article. I will do a little lightning talk about those filters and there has also been quite a lot of work done on that during the sprint this week. This is another that's you know maybe not so relevant for English but

### [10:49] Icelandic Spell Checking

**Speaker 2:** [10:49] this has This is important for us because we are a tiny nation and we have our own tiny language and because it's tiny, you know most companies are not focused on like developing things in Icelandic or supporting Icelandic. And English is dominant in the technology that we use. So the Iceland government now has a like a language tech program where they're like you know getting the companies to include Icelandic and we are trying to present more technol technology to people. can support Icelandic.

[11:34] So we did a little bit of spell checking work. Baku doesn't have a specific plugin for spell checking, but it is possible to extend Draugh Tail to do this. And there was a research project in the University of Iceland and an Icelandic language technology company that's been working for a couple of years. And they wanted to enable spell checking on Wagtail sites. There was a small project that Hinrik Hafstenson led which was a customization in trap jail Which creates

[12:20] like a small spell checker. So you have like a button in the toolbar so that when you've when you finished writing your Text, you just click it, it will then take the text, send it to the spell checker engine, and it will get a lot of feedback back underlining all the suggestions and also like real solid reasons for why it's such like explaining this suggestion. So then the editor can either accept them or decline them. Yeah, so this is work that's like ongoing but it's already been used being used by at least one or two of these new sites

**Speaker 1:** [13:01] Yeah, it's not really ready, but it's yeah, somewhere along yeah, it works.

### [13:09] Advertising Integration

**Speaker 2:** [13:09] And then ads. Sorry. I guess as we mentioned before we develop ad tech solutions as well for the Icelandic market and AirServe is our ad serving platform. We're now serving out around 600 million impressions a month, which is quite a lot for a nation of 370,000 people. And most of the ad agencies are using our solutions. We have in the last three years been working on a version of this for the publishing part, so for the websites themselves, not just for the agencies. And we have developed a little package that we use

[13:54] to interface with Wagtail so You can actually like just get an API key and then pull all the add zones from our ad tech software into Wagtail and then you can just like select it into zones on your website. Yeah. So you can see I'm gonna give you a little demo of how this works

### [14:53] Wagtail Newsroom Demo

**Speaker 1:** [14:53] So here's the premier news outlet for Wagtail Space, of course.

**Speaker 2:** [14:57] Wagtail News.

**Speaker 3:** [15:00] So we're gonna preview the page. So this is a like a basic template built up using stream fields. Maybe you can show us how you lay out it Yeah. So you just create a newest block. It's nothing remarkable really. We have a few layouts defined, like how you want it to appear. You can preview it. So now we have one featured news item on the left And all the other news just get rearranged really through the rest of the blocks if you change something.

[15:47] So if you feature an article in this block because you want to highlight it. So you notice that there's no content there really, it's just It's just referencing a template. We're gonna highlight Google Summer of Code So that's been moved up to the front and the rest just rearranges, which is nice. I think it's missing it's missing an ad. So we pull it out of the we have an ad block, it's rendering the snippet which is pulled Well, create it from the API that is communicating with the ad

[16:33] server solution that you have. That's all, yeah.

**Speaker 2:** [16:38] Yeah, so this is just a little and yeah and we'll do a little bit on the filters later on. So

**Speaker 1:** [16:45] I think that's it for now. Thank you.

**Speaker 2:** [16:47] Thank you.

### [16:55] Questions

**Speaker 3:** [16:55] We do have some time for questions.

**Speaker 1:** [16:57] Okay.

**Speaker 3:** [16:59] Can I get

**Speaker 1:** [17:03] All right.

**Speaker 4:** [17:06] Yeah, the question you referred to editors earlier because of the well you have a newsroom people using this CMS to Create the news. Was there a reason or was there one specific question that you had that they didn't have any time or the knowledge to use the interface to just create the pages all by themselves Or maybe the question is, what's the most annoying thing they mentioned that they didn't want to do which they had to do otherwise it wouldn't be possible?

**Speaker 2:** [17:32] I would say that when we started this it was it was basically l like having to lay out the page every time because by default you kind of have to fill in your stream fields with data or have some Like some rules for it, but the problem is that the because the blocks are like they are, they don't really know what's happening around them. So if you say, you know, give me the latest three articles you'll just get the related three articles in all of them. We had a lot of problem with like oh sorry. So we had like quite a lot of duplicates. Even when we were like fetching stuff from different categories and different stuff you always had one here and there that was duplicated throughout the whole thing.

[18:22] So as soon as we were able to kind of pipe the context through the stream field, then we could start doing like bookkeeping of what was already there which makes it a lot easier for example if you have like a sports section very like very low on your side and then you have a huge piece of sport news at the top, then it just kind of falls off down there.

**Speaker 1:** [18:53] And I also think that they had problems with the you know content becoming stale because it was a lot of work to maintain it. They always had to like regularly check, okay, are we outdated or not? They don't have to anymore, so

**Speaker 5:** [19:11] with 170,000 pages, did you have to do anything like specific with search or filtering to empower them to find the right pages? Because I know the page tree is not gonna be that useful at that scale

**Speaker 1:** [19:23] Yeah, this is a constant problem. We use Elasticsearch, but it's it's not optimal. It's really hard to sit keep in sync it's resource intensive and yeah it's we're always trying to find some better ways to do it, but Elasticsearch works.

**Speaker 2:** [19:44] Yes.

**Speaker 1:** [19:45] Quite good, you know, for most of our cases.

**Speaker 2:** [19:49] One thing also we instead of having all the pages in like one flat tree, we have like these like super categories like news and people and events and stuff like that where people like write the article enter And then we have like categories for each of those. So we can and then we can scope those. So you can say I want this block only to have that subcategory So you could go all the way down to just Icelandic football or something and you would just get articles that are tagged with Icelandic football. Cool. There was more

**Speaker 4:** [20:31] question over here. There you go.

**Speaker 6:** [20:34] Yeah, I've got a question about the cybersecurity challenges for developing news sites. How were you able to prioritize that for the journalists, especially in this in this generation with media freedom

**Speaker 1:** [20:58] Can't remember that we did, but I mean well we are fans of Django to begin with. Django is I in my opinion a very secure framework to start with. So we have not really made any special arrangements for cybersecurity, but we do use Cloudflare for caching. We have sometimes had to use I mean we had like a denial of service attack at one time, so then we had to use a like a turn on some firewall features in our Amazon cloud account but

[21:43] apart from that we have not had many problems with this

**Speaker 4:** [21:47] I'll be interested to talk with you after
