首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法用Wordpress迁移迁移别名

无法用Wordpress迁移迁移别名
EN

Drupal用户
提问于 2018-06-20 22:06:37
回答 1查看 305关注 0票数 1

我正在使用Wordpress模块从Wordpress迁移到Drupal 8,我试图将别名设置为链接值(<link>https://myurl.com/wordpress-path</link>)。我在消息来源中添加了以下内容:

代码语言:javascript
运行
复制
    -
      name: link
      label: 'The link value'
      selector: 'link'

并进行以下处理:

代码语言:javascript
运行
复制
  path/pathauto:
    plugin: default_value
    default_value: 0
  alias:
    -
      plugin: get
      source: link
    -
      plugin: str_replace
      source: link
      search: 'https://myurl.com/'
      replace: '/'

我也尝试过path/aliaspath,而不是alias,但是没有运气。我验证了str_replace插件确实返回了正确的值,但不知何故它没有保存在节点中。

这是我的完整migrate_plus.migration.my_wordpress_wordpress_content_post.yml:

代码语言:javascript
运行
复制
uuid: 5b3b3b84-8d41-4a80-b1ca-c9046c269297
langcode: en
status: true
dependencies: {  }
id: wp_wordpress_wordpress_content_page
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - WordPress
migration_group: wp_wordpress
label: 'Import content from WordPress XML'
source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: xml
  item_selector: '/rss/channel/item[wp:post_type="page"]'
  fields:
    -
      name: title
      label: 'Content title'
      selector: title
    -
      name: post_id
      label: 'Unique content ID'
      selector: 'wp:post_id'
    -
      name: content
      label: 'Body of the content'
      selector: 'content:encoded'
    -
      name: excerpt
      label: 'Excerpt of the content'
      selector: 'excerpt:encoded'
    -
      name: pubDate
      label: 'Publish date of the content'
      selector: pubDate
    -
      name: post_date
      label: 'Post date of the content'
      selector: 'wp:post_date'
    -
      name: status
      label: 'Published status of the content'
      selector: 'wp:status'
    -
      name: creator
      label: 'Username of the content creator'
      selector: 'dc:creator'
    -
      name: post_tag
      label: 'Tags assigned to the content item'
      selector: 'category[@domain="post_tag"]/@nicename'
    -
      name: category
      label: 'Categories assigned to the content item'
      selector: 'category[@domain="category"]/@nicename'
    -
      name: link
      label: 'The link value'
      selector: 'link'
  ids:
    post_id:
      type: integer
process:
  title:
    -
      plugin: get
      source: title
  body/value:
    -
      plugin: get
      source: content
  body/summary:
    -
      plugin: get
      source: excerpt
  created:
    -
      plugin: callback
      source: post_date
      callable: strtotime
  changed:
    -
      plugin: get
      source: '@created'
  status:
    -
      plugin: static_map
      source: status
      default_value: 0
      map:
        publish: 1
  uid:
    plugin: migration
    migration: wp_wordpress_wordpress_authors
    source: creator
  body/format:
    plugin: default_value
    default_value: basic_html
  type:
    plugin: default_value
    default_value: page
  path/pathauto:
    plugin: default_value
    default_value: 0
  alias:
    -
      plugin: get
      source: link
    -
      plugin: str_replace
      source: link
      search: 'https://myurl.com/'
      replace: '/'
destination:
  plugin: 'entity:node'
migration_dependencies:
  required:
    - wp_wordpress_wordpress_authors
EN

回答 1

Drupal用户

发布于 2018-06-21 19:39:31

结果发现path/alias成功了。我一定是做错了什么,否则我的页面被缓存,它没有重定向到别名。

代码语言:javascript
运行
复制
path/alias:
  -
    plugin: get
    source: link
  -
    plugin: str_replace
    source: link
    search: 'https://myurl.com/'
    replace: '/'
票数 1
EN
页面原文内容由Drupal提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://drupal.stackexchange.com/questions/263563

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档