1

I am importing content from SharePoint into Drupal 8 using Migrate Source CSV and a large CSV file. I successfully mapped id,title,body,date. But I cannot map the path alias? In Drupal 7 the Feeds module mapped this easily. Does anyone know how to do this in Drupal 8?

This is a snippet from my yml file:

process:
  id: id
  nid: nid
  title: title
  alias: path
destination:
  plugin: entity:node

my csv file

"id","nid","title","body","path","date"
"1","1","title1","bodytext","content/12/mypath","2014-08-12"
2

Just tried it out while trying to find an answer to a similar question. Here's how it should look:

source:
  ...
  constants:
    slash: '/'
process:
  ...
  // This parameter should be "path" and not "alias".
  path:
    plugin: concat
    source:
      - constants/slash
      - path

Note: Path aliases get imported the first time you import the data. However, if you run drush migrate-import MIGRATION-ID --update, the path aliases do not get updated.

2

@Jigar's answer is close but not quite. Here is what I eventually figured out. It should be path/alias and not just path. Also, if you have pathauto module installed it will create the path based on the patterns. So, in order for our path to be imported from csv, the path auto needs to be disabled first. You set path/pathauto's default value to 0 to do that.

source:
...
 constants:
  slash: '/'
....
process:
...
 path/pathauto: 
   plugin: default_value
   default_value: 0 # Disable pathauto
 path/alias: 
   plugin: concat
   source:
     - constants/slash
     - url
0

I haven't tried mapping paths in a node migration myself (the core upgrade path migrates aliases separately), but I will observe one thing - the path needs to start with '/', so you should use the concat process plugin to prepend that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.