Lesson
1
Introduction
Unlock the power of scripting content migrations into Sanity, fix past platform mistakes, and confidently handle unique content structures. Import users, posts, pages, categories, tags, and assets, and convert HTML markup into Portable Text.
Simeon GriggsPrincipal Educator at Sanity
Knut MelværHead of Developer Community and Education
Before starting this Course it may be beneficial to have completed:
Log in to mark your progress for each Lesson and Task
When WordPress was launched in 2003, it was primarily a blogging platform. Over the years, however, it has been used as a CMS, powering over 40% of all websites (according to some statistics).
While WordPress has been a great solution for many (in fact, both authors of this course have shipped many WP sites throughout the years), it does have limitations:
- The content is tightly coupled with the front-end presentation layer, making it harder to reuse and adapt
- Extending and customizing can get complex and brittle, causing downtime
- The rich text editor stores content as HTML, making it hard to reuse
- Performance and scaling can be challenging, especially for larger sites and teams
- Security patches and updates can be a never-ending task that potentially breaks your site in interesting (and costly) ways
This course will take you through moving your content out of a realistic WordPress installation and into Sanity. With that being said, in our experience, there is a lot of variety in how WordPress sites have been set up and how the content is stored, like:
- Custom fields and post types added by plugins or themes
- Content stored in the WordPress database in unexpected ways
- Multilingual content using various plugins and approaches
- Media and files are stored in multiple places, not always as WordPress attachments
- Inconsistent use of Gutenberg blocks, the Classic editor, or page builder plugins
But worry not! In this course, you’ll learn how to add structure to your WordPress content and bring it into Sanity by building schema types, import scripts, and migration jobs.
Many of these techniques will be directly transferable for re-platforming from other HTML-based CMSes like Drupal, Adobe Experience Manager, SiteCore, etc.
The lessons in this course are WordPress-specific implementations of the principles outlined in Refactoring content for migration.
Now, roll up your sleeves and get ready!
If you're not quite ready to start migrating today we have additional resources you may find useful to compare Sanity and WordPress to better inform your migration journey.
- Comparing WordPress to Sanity, a look at the differences between Sanity, a Content Operating System and WordPress, a blogging platform.
- Contact us to discuss a large-scale migration, while this course covers the basics and is applicable for most WordPress installations, your use case may be of a size and complexity that needs more attention. Contact us for more details.
To complete this course, you will need the following:
- A free Sanity account to create new projects and initialize a new Sanity Studio. If you do not yet have an account, running any
npx sanity
command will prompt you to create one. - Some familiarity with running commands from the terminal. Wes Bos' Command Line Power User video course is free and can get you up to speed with the basics.
- Node and npm installed (or an npm-compatible JavaScript runtime) to install and run the Sanity Studio development server locally.
- Some familiarity with JavaScript. The code examples in this course can all be copied and pasted and are written in TypeScript, but you will not need advanced knowledge of TypeScript to take advantage.
See Installation for more options when starting new Sanity projects
Get up and running with all the prerequisites
If you're stuck or have feedback on the lessons here on Sanity Learn, join the Community Slack or use the Feedback form at the bottom of every lesson.
It is sometimes tempting to release one-size-fits-nobody wordpress-to-sanity
import tooling. But the reason that you want to get out of WordPress is probably partly how it doesn't let you structure and reuse content. It's important to see a content migration as an opportunity to fix the mistakes of your current platform, not to recreate them in a new environment.
This course intends to demonstrate the power of scripting content migrations into Sanity and free you from the presentational thinking that dominates website-specific CMSes—ushering you into a world of structured content.
While WordPress' conventions make most of the source data easy to target, the shape of your content in Sanity may be unique to your organization's use case.
Your WordPress installation likely also has plugins that augment the content in some way that we cannot account for, but you should be able to handle it once you complete this course.
While this course focuses explicitly on the technicalities of moving your content over from WordPress, we must stress that bringing your team over is equally important. This goes for your engineering colleagues, your content team, and/or clients. Moving from a CMS to a Content Operating System like Sanity will also change how you work with content (for the better).
We recommend that your team take the Re-platforming to Sanity course—it can also be run as a workshop! Approaching a content migration project cross-functionally, will help you uncover those "unknown unknowns" more quickly, making it easier for everyone to get up to speed.
After this course, you will have imported users, posts, pages, categories, and tags into Sanity, created references between them, and uploaded assets. You will also have the skills to import content types like menus and comments.
You'll convert either post-processed or pre-processed HTML markup into Portable Text from the Classic or Block editor.
This course does not handle augmented content that may be modified by page builder (Elementor, Divi), SEO, or e-commerce plugins; however, anything accessible from the REST API can be added to your final import script.
You have 1 uncompleted task in this lesson
0 of 1