Rewrite local link/image references in content

Created on 3 June 2016, about 9 years ago
Updated 21 July 2023, almost 2 years ago

Any links or img references to migrated content/files that exist in the migrated content needs to be rewritten to point to their new locations in Drupal. This will require a process plugin to be applied to the text field mappings.

πŸ“Œ Task
Status

Postponed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mikeryan Murphysboro, IL, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States oknaru

    Hello All, I am trying to migrate big blog site to D9 and my images are not getting migrated to the D9 articles. Can someone please explain me what this line is for the WP XML file. How do I migrate image first and then run the blog migrations. I appreciate the help.
    using D9 with following migration modules and wordpress_migrate latest alpha5 release.
    drupal/migrate_manifest 3.0.2 Supports the running of migrations using a...
    drupal/migrate_plus 5.3.0 Enhancements to core migration support.
    drupal/migrate_source_csv 3.4.0 CSV source migration.
    drupal/migrate_tools 6.0.2 Tools to assist in developing and running ...
    drupal/migrate_upgrade 3.2.0 Drush support for direct upgrades from old...

    I tried multiple attempts with different setting no images are getting migrated to blogs.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    It would be nice to be able to import images as well, they are after all present in most web sites :)

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    It looks like image import is supported, reading this in the README:

    Importing Image Assets

    For the new importation of attached images including post thumbnails (also known as featured images) you should:

    • Assign an image field for these assets in the migrate process.
    • Before importing the content posts, import the media assets.
    • Import the media assets.

    https://git.drupalcode.org/project/wordpress_migrate#importing-image-assets

    But do I need to install the Media module, and create image fields of type Media first? I tried adding a Media field to the standard Article content type, but I still only get the standard field_image offered under /admin/structure/migrate/wordpress_migrate/image_select ...

    I also tried to import the wordpress_attachments migraton as the first import, but it looks like no images are getting imported. (I assume "import the media assets" means wordpress_attachments in the migration, but I am not sure ...)

    It would be great to get some more details added to the minimal steps required for this to work. Thanks!

    PS. It is not clear to me, if this is the existing source WP site, or the target Drupal site URL you need to enter here:
    "Enter 'Base url of the WordPress site' into the first stage of the wizard to automatically generate permalinks to the new content nodes."

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    I found an issue about adding Media support, which will be awesome to get! So that answers my question about that.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    I was using two local DDEV instances, and finally figured it out, and will add the steps in https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib... β†’ .

    Sorry for the noise.

    But back to this issue, and just confirming that it still needs to be looked at: Like I wrote, I am testing in DDEV, with two local instances (from https://my-wp-site.ddev.site to https://drupal.ddev.site), and the domain in inline image links remains to be the original ... like this (it should be https://drupal.ddev.site):

    http://ddev-my-wp-site-web/wp-content/uploads/2025/05/29d82e28-5fe8-3a88...

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    Where I left off the WIP on ✨ Import as media Needs review I was trying to clean up how it loops thru the content types (posts, pages) and bumbled something in the for loop key line at https://git.drupalcode.org/project/wordpress_migrate/-/merge_requests/39... - and consequently this function was not getting the right params . public function CreateSingleMediaTypeMigration($migration_id, string $media_type_id, $process, string $config_key): void {

    regarding : "Enter 'Base url of the WordPress site' into the first stage of the wizard to automatically generate permalinks to the new content nodes."" . this could be clarified as it is going to be used to form the pathauto entries locally and is used to search the XML file for old GUID type entries of the current, permalinkified url. those values would be the domains it is exported encoded as is. (sorry getting tired here)

    regarding fixing attachments i have also been wondering how it should behave when there are none to be fetched, via unavailable domain or etc. it could be guided to manually seek a different domain provided by import user with an additional text field ("attempt to fetch and then save images from the following URL domain, instead of the base URL domain") would serve such a purpose. you could then be slurping the assets from that kind of temp subdomain into your prod site.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia
  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    adding ✨ attachments / featured images not fault tolerant if missing Active regarding behavior for missing media. which could include missing domain or 404 specific images, timeouts etc.

Production build 0.71.5 2024