Wagtail Translate
Published June 27, 2024
This video features Coen van der Kamp at Wagtail Space US 2022 in Cleveland, Ohio, USA.
Coen van der Kamp
https://www.fourdigits.nl
Wagtail Guide - Getting started video: https://youtu.be/
Code: https://github.com/
A user guide for content editors. Documentation on how to use your Wagtail site.
I’d like Wagtail guide to be an installable package, to be used in Wagtail sites.
It will give you a getting started tutorial out of the box.
You can also customise and extend the guide.
It allows to explain a feature that is unique to your Wagtail site.
I’m not trying to write a guide on each and every Wagtail feature.
I’m trying to make a package that allows you to create guide to be used by your client.
Coen van der Kamp presents Wagtail Guide, an installable package for creating client-facing documentation for Wagtail sites. It uses pytest, a live server, Selenium, fixtures, and configurable chapter functions to operate a site, capture screenshots, and generate Markdown documentation or narrated videos with text-to-speech. The package is meant as a practical getting-started and how-to guide for a specific site, not as a replacement for Wagtail’s complete editor documentation. He demonstrates customizing branding and navigation, writing chapters that log in and highlight interface elements, and explains how the generators and context managers produce the output. He also discusses future packaging alongside Wagtail releases, multilingual speech generation, possible Wagtail integration, and invites contributions.
Summarised automatically from the transcript.
Wagtail Guide is an installable package for creating client-facing getting-started tutorials and how-to documentation for a specific Wagtail site. It complements rather than replaces the main Wagtail Editors’ Guide.
Discussed at 0:48By default it creates Markdown documentation with login instructions, annotated screenshots, a getting-started guide, and a demo page showing common Wagtail content elements.
Discussed at 3:53Install it with pip; while it was not yet on PyPI at the time of the talk, the project’s GitHub page explains how to install it directly from GitHub. Installation provides a `build guide` management command.
Discussed at 4:41You can override the Wagtail admin branding, configure the Markdown documentation site’s chapters and appearance, and define your own guide chapter callables. These chapters can create content, drive a browser through login and editing actions, and capture screenshots or highlighted UI elements.
Discussed at 6:15The build command runs tests using a live server and a browser driver such as Selenium. Configured chapter functions write Markdown or another output format, while the video generator additionally creates narration with text-to-speech and produces a video file.
Discussed at 10:17It uses pytest, fixtures, a live server, and Selenium to control the browser and take screenshots. A main test loads the configured chapters, and factory context managers collect headings and other content before writing the resulting files or processing a video.
Discussed at 12:57The speaker suggested releasing Wagtail Guide versions alongside Wagtail versions, updating selectors for each new Wagtail release, and rerunning the management command against the updated site to regenerate the documentation.
Discussed at 18:07A dedicated documentation site had not yet been created, but the project included a comprehensive README with the instructions needed to get started. A fuller documentation site and output showcase were planned for later.
Discussed at 19:17Yes. The Mozilla text-to-speech tool used in the demo supports Spanish and several other languages, though the speaker was unsure whether it supported Dutch; the generator can also be adapted to use another speech tool.
Discussed at 20:41The speaker intended it to work across Wagtail versions and planned to update the package for new Wagtail releases, including Wagtail 3.
Discussed at 21:46Automatically transcribed, so expect mistakes in names and technical terms.
Speaker 1
So my talk is about Wagdo Guide. My name is Koen van der Kampen and I work at For Digits. And for Digits is a Python shop. and we work with Django and WagTil and most of our Python application run in the browser. So I'm a Python developer. I'm also a Wagtail Core team member And I'm also the organizer of Actospace, the Netherlands. And here's the big announcement. Rectal Space NL is happening. The conference is 15th to 17th of June and we'll have a full event with sprint and talks. And you can also sign up for talks only. So Wagdil. space is the website that lists all Wagdil space events and 2022 is
the Dutch version. I'll share the link. No worries. First look at my talk and after that sign in for our event. So back to WacDo Guide. The initial ID is a user guide for content editors. and documentation on how to use your Waxel site. That's the output. And I like it to be an installable package that Python shops like ourselves can use and have documentation to present to our clients. So not only send login credentials and URL, but also have a document that the client can read to get started. So
the initial idea was born in during a sprint at Torchbox in Bristol, UK. in 2020 and the idea got shelved. I forgot about it. And then recently there was a discussion about the editor's guide as a separate repository or website. And then I thought I have to revise my ID and look it up, see if it's still something we can use. So if you don't know the Wecto Editors Guide, it's this section in the Wecto documentation. And it's a wall of text. So is my product a replacement for the editors
guide? No, it is not. It's intended as a package for in your own Recto site. It's intended for your clients, it's intended to be a getting started tutorial or how-to guides. It's in no means trying to be complete and explain everything about Wagtail. Can it be used to help building this new section of the record documentation? Yeah, maybe it might be useful. So yeah, I'm reiterating myself. Installable package, getting started tutorial, and the how-to dot is yeah, you can fill that in yourself. It's intended to give you the tool to make your own how-to
guide. The targeted audience are content editors, people who get started with Wagtail. and moderators and administrators that have to do more complex things, maybe, but not that much. So in this talk, I'm gonna show you how to install the package and then configure it. Also how you can customize it and there's a dotted line because You don't have to customize if you like how it is, you can use it like that. If you want to extend it or change something, you can there's the possibility to do that. And then the product vector guide has a built output, but you still have to use that output yourself. You have to serve it or
do something useful with it. So right to guide. Let's look at the output. This is Markdown MK docs, markdown docs. And it has here the instructions how to log in and it made a screenshot of a vector site and filled in the fields. Also highlighted the element that you have to click. So all this stuff you can define and then it makes screenshots and shows it. The default, this is the default, will give you this getting started guide and also a demo page with all the elements you can create, like paragraphs, audit and unordered list, code.
images of cats, screenshots with the browser or screenshots without a browser, and also highlight an element. So let's dive a little bit deeper and go to the code. To install it, you have to just pip install Wagto Guide. It's not on PyPI yet, but if you go to the GitHub page, it has the instruction how you can install from GitHub. And then you've got Wacto Guide included. And this makes you give gives you a command, a management command, the build guide. And if I do this It makes a database and starts up your browser
and takes some screenshots And this output of this all goes into the documentation directory and you've got images and also the markdown So you've got the demo page and an index page. Yes, up next I've got something on the screen. Okay. You can also define chapters for your guide. And One of those is home getting started.
No, let 's revert that. Let's customize the site first. So I've got here The base HTML of the Wagtail admin and it overrides the branding icon, the logo. And I've got also whack the hooks file and I register an element cars. And then in Yeah, this. So if I run the guide now, this will take a moment. Open up a browser again
Let me change one more thing. Markdown docs has this definition of how which chapters are there and how they look. And you can change that quite easily. And if I now go back to the documentation, it changed. The look is different. I've got getting started. I also have my icon. And also got my care menu. So now the documentation is about my site. Let's go to base again. And now I've got here a home guide getting started. This is a callable that you can use to define your own
guide what it should do. So we've got a markdown factory, it generates the index markdown file the title of this page is getting started and the documentation first paragraph is this and then there's a heading and a list and here I create some content. A user is created and with a live server I go to a login URL and fill in the username and the password. and then find the login button and click it. And after that, I don't want to rest of my default guide, I want to show that there's an edit bird in the front end of the site. So I navigate to the front end.
to the root URL and I'll highlight the edit bird and then I also click the edit bird and you see that the menu opens so Let's do this. Again, the database is created, browsers open, screenshots are taken. And documentation is updated. So now we've got the front end with the highlight of the edit bird and the menu open So the output now is Markdown, but
these factories that create The documentation can also be something else. They could also create restricted text RST or anything else, and then I thought of hey, maybe we can also create video So I've got now vector guide video getting started. And let's see what this does Again, database created, sites run, screenshots are taken And this takes a little bit more processing.
So there's text to speech and now it starts creating the video. So we can all look at the progress bar, but we can also look at Recto Guidecode which is might be a little bit more interesting. So this is build guide management command. It calls PyTest. And the way it works is that the main test gets a live server and a driver. The driver is the thing that controls the browser and some settings. And here we just call each Weg to guide chapter setting as a callable. We import the string and we call it with the live server and the driver. And with that it calls everything you configure in your settings.
So this finished. I've now a video file, and yeah, let's see how it looks.
Speaker 2
Open a browser and go to slash admin. Enter your username and password. Click sign in. Welcome to the administrative interface or admin for short. This first page is called the dashboard, it shows a summary. The gray bar on the side is the sidebar. Wherever you are, you can always click the logo to navigate back to the dashboard Use search to find content. The main navigation contains pages, images, and documents. In reports you will find an audit trail and other reports. In Settings you can manage users and configure your site. Manage your personal details and preferences in the Account Settings menu.
The logout option is in Account Settings. Yeah, I don't know.
Speaker 1
This was my talk about the vector user guide, and I'm happy to answer any questions.
Speaker 3
You couldn't hear it, but there was tons of applause in the actual room. That was a very, very cool demo, Cohen. And we did have one question that star off the top. Wanted to know more about your development process and the code behind how this works.
Speaker 1
Yes, I can show a little of that. First of all, there are some ingredients. Of course, you saw me run the management command. And behind the scene, it just runs tests. So it's PyTest. And we also created content with fixtures. There's this live server and Selenium. Selenium is a Chrome driver that controls the browser and that takes the screenshots. And the output is then marked down. The static site builder itself that I showed isn't included. It's like the an external package and all that combined is the user guide and i can show some code because i showed it really quick
Py test you can just call with a location and directory And then it runs all the tests in that directory. So here I look up the current directory of this installed package. And look all the tests who are there. And there's just one test, there's one main test. And this test looks up the chapters and calls the chapters one by one. And a chapter like that is This a getting started, it receives the live server and the driver, and we've got the markdown factory. And this factory is a context manager. The context manager works in
When you call it with the with statement. I think a lot of people do this when they open up files. You are sure if you open up a context manager, an action is run when all the indent stops and the and the code block closes. So I've got here this doc and I just write all these elements to this document and I'll have to look at the markdown factory. Can I jump to that? Nope. Let's take the video. I don't know the way in my own code. Factories.
Here we go. So the markdown factory, when you enter it, it returns itself. And when you exit it, it opens up a file, which is and writes to this file name. The self-file name is something that it got on the init And then it just starts writing the code blocks. And every code block, like a heading, is just a piece of text. So the markdown for heading is Two signs and the content. And all these blocks are just stored here in the on the context manager. And when you close it, it's written to a file. And the same is for a video only the processing in the end is a little bit more complex
on exit. It just creates a video file. and creates the audio with text-to-speech. So that was the long answer. Maybe there are other questions
Speaker 3
Thanks so much. Do we have more questions in the audience or on Zoom? When you try to set this up with some sort of automation
Speaker 1
like having you know every time you kind of make an update have to run a new
Speaker 3
Have you ever tried to set this up with some type of update in the second half? Automation. And some type of automation.
Speaker 1
Not sure if I understand the correct the question. Yeah. The automation of the of the of creating script
Speaker 3
Yes.
Speaker 1
Yes. Yeah, there's Selenium browser plugins that you can use. to record your action in the in the screen and the and the way I use it right now is most of the times I just set a breakpoint. somewhere in the code and then run the test and then I get the breakpoint in the browser. The browser just stops there and then I can inspect the HTML and just type in my terminal the instructions that I want to try out. So that's the way I work currently. But I can I imagine that recording your actions in a browser is perfectly fine if it out outputs the selects that you need
Then you're halfway there
Speaker 3
Awesome. And we were also interested in automation on updating. Anytime it updates, could there be an integration of the process to update the documentation every time there's an update?
Speaker 1
Yes, that's a good question. I didn't figure that out yet because I just worked to against the current stable branch. But I imagine that I will release packages with the same version as Wagtail. So every time Wagtail updates, there's a new release of WagtailGuide, and then all the selects are updated to fit the new wagtail and yeah that's a way to get around it so then you can run the management command again against your updated site and you just get new documentation
Speaker 3
Thank you. Do we have any more questions from in the audience or on Zoom? We have time for about two more questions. I think it was slow so I can repeat it. Is there a wagtail guide for setting up wagtail guides? Is there a wagtail guide for setting up wagtail guides? Where do we go?
Speaker 1
The documentation on the documentation generator is not there yet. I created this a month ago and I worked on it two days ago, seven days ago, and that's about it. There's a comprehensive README and it will get you started with everything you need. So that that's some documentation, but I would love to create a documentation site that also showcases the output And also the instructions of working with Rector Guide itself. But that's on my to-do list.
Speaker 3
It's hard to describe how excited the room was. I mean, everyone I just really appreciate that. So more to do as there always is, but this is fantastic talk. I think we can probably take maybe one more question. If anyone in the room or on Zoom has one.
Speaker 1
Yeah, I would like to say that pull requests and contributions are welcome. So if you if you're enthusiastic about this and you can see some use for it in your own company. and to help your own clients yeah contribute.
Speaker 3
I have two questions. Is the text-to-speech available in languages other than English?
Speaker 1
I used the text-to-speech from Mozilla and they have Spanish and some other languages. I don't think they have Dutch, but they have they have a few languages. Yeah. So Not only English, but I don't know which languages they provide. But basically you could adapt the generators themselves to use something else. I now run a document a Docker container to handle the text to speech. Yeah, it would be easy to run it against some other
tool to get your audio files.
Speaker 3
Awesome. We have one more. Are
Speaker 4
there any plans to start using this? Maybe back till three For example.
Speaker 3
Are there any plans to start using this, for example, in Wagtail three?
Speaker 1
What I would like to have in Wagtail is a menu item that you can click and then see your own documentation. So I would say it would should work in any Wagdle version. Yeah. I intend also to update the package when a new Wagdle release is there. So yeah It will work in write till free. So
Speaker 3
this is the last talk before lunch. And so if you wanted to continue to have more conversations about this really awesome. package of this talk, feel free to chat on Slack. And I'm going to introdu bring up Tim and Vince to chat a little bit more.
Speaker 4
We just have one small thing. Thanks so much, Cohen. Round of applause for Cohen. That was amazing.
Speaker 1
Thank you. Bye-bye.
March 24 - 26, 2022
Cleveland, Ohio, USA
Note: 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 July 19, 2024
Published July 19, 2024
Published July 19, 2024
Published July 19, 2024
Published July 19, 2024
Published July 19, 2024