Tutorial Wagtail Version: 2.x
Snippets are Wagtails way of re-using existing data. For example, being able to select a Blog Author (or multiple authors) instead of having to add a name, image and website for every blog author in every blog post you make; instead you can simply fill out a form once, and re-use the final data with a couple of clicks.
"Snippets are pieces of content which do not necessitate a full webpage to render."
Above is the line from the Wagtail Docs that describes a Snippet. It's accurate, but maybe a bit tricky to understand at first.
You can think of a Snippet like pieces of data that you can re-use. If you're familiar with the coding notion of functions (re-usable chunks of code), then you can think of a Snippet as a function for storing and retrieving data from the Wagtail Admin.
Some example where Snippets are useful:
In this video we'll be using Blog Authors as the the example. Here's a copy & paste example you can use:
Videos not your thing? That's OK. Here's the link the full Git Commit so you can see what was added in this video at a glance.
https://github.com/CodingForEverybody/learn-wagtail/commit/de5e86e29802c1548cabb148ca0e41dafcfe928d
Registering Snippets (Blog Category) using Checkboxes
Posted on
In this tutorial we'll be learning how to register another Wagtail Snippet, but instead of using an Orderable and a SnippetChooserPanel (like the previous lesson) we're going to use a ParentalManyToManyField and a form widget to create Checkboxes in the Wagtail Admin.
17. Translating Models and Snippets
Posted on
09. Translating Django Models, Views and Templates
Posted on
19. Adding Comments using Django Comments
Posted on
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.