CoursesMigrating content from WordPress to Sanity

Migrating content from WordPress to Sanity

11
Lessons
Simeon Griggs
Simeon GriggsPrincipal Educator at Sanity
Knut Melvær
Knut MelværHead of Developer Community and Education
Track
Replatforming from a legacy CMS to a Content Operation System

Lessons in this course

Compose a powerful, reusable migration script to convert live data into Studio-ready structured content with references and assets. This module focuses on WordPress' REST API but could be adapted to any data source.


1: Introduction

1
Task

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.


2: First steps

1
Task

Harness the power of scripting content migrations into Sanity, fix past platform mistakes, and confidently handle unique content shapes and augmentations.


3: Preparing a Studio and schema types

10
Tasks

Configure the Sanity Studio schema to view your imported WordPress content in real-time.


4: Preparing your migration script

8
Tasks

Import WordPress content into Sanity in bulk using the CLI Migration tool, creating a script that queries the WordPress REST API and writes documents to Sanity.


5: Processing post types

4
Tasks

Create a dynamic migration script for WordPress post and pages types that accepts custom content transformation options to unlock reuse potential.


6: Creating complete documents

13
Tasks

Transform WordPress posts into more complete Sanity Studio documents with categories, authors, dates and more, using dedicated functions for each post type.


7: Uploading assets performantly

6
Tasks

So far the migration script has staged documents to be created sequentially, now we need to introduce asynchronous functions to upload assets, that has the potential to slow the import process down.


8: Converting HTML to Portable Text

2
Tasks

Migrate HTML content from WordPress to Portable Text in Sanity, gaining presentation-agnostic block content and rich querying and filtering capabilities for your structured content.


9: Converting WordPress blocks to Portable Text

11
Tasks

Convert raw WordPress content into Portable Text, create custom schema types in Sanity Studio, and make authenticated requests to WordPress.


10: Restructuring content

1
Task

Take the opportunity to transform content from presentation-focused in WordPress to structured content in Sanity


11: Conclusion

1
Task

You now have all the skills to convert individual post types from WordPress' presentation-focused types to structured content in Sanity Studio.