Not production code This is primarily an example of how you can script a Wordpress to Sanity.io migration. You most probably have to tweak and edit the code to fit to your need.
const filename
in migrate.js
to the path of your wordpress export xml filenpm start
to log out the converted sanity documents in the terminalnpm start > myImportfile.ndjson
sanity dataset import myImportfile.ndjson
in your Sanity project folderMostly probably there is additional content that this script doesn't migrate, however, it should cover the most usual patterns, so that you can build it out for your specific use case.
xml-stream
where it doesn't seem to emit errorsparseBody.js
) is easier with the script in /test
/schemas/defaultSchema.js
/lib/sanitizeHTML.js
)