Migrating nodes

Last updated on
11 March 2021

This documentation needs work. See "Help improve this page" in the sidebar.

Nodes can be migrated to Drupal 8 by using the entity:node destination plugin.  

The text formatting of the body field is defaulted to Basic HTML in this example. For more information, refer to the API documentation of the EntityContentBase destination plugin.

id: custom_article_migration
label: 'Custom article migration'
source:
  plugin: embedded_data
  data_rows:
    -
      id: 1
      title: 'Page 1 title'
      content: '<p>Page 1 content</p>'
    -
      id: 2
      title: 'Page 2 title'
      content: '<p>Page 2 content</p>'
  ids:
    id:
      type: integer
process:
  nid: id
  title: title
  body: content
destination:
  plugin: entity:node
  default_bundle: article

Other source plugins

The examples on this page use the embedded_data source plugin for the sake of simplicity so that this example can be copy-pasted as a working example. In the real world, you would most probably want to migrate the nodes using for example the CSV source plugin or to write a simple SQL source plugin to read the source data from another database.

Executing the migrations

Read more on how to execute migrations.

Help improve this page

Page status: Needs work

You can: