[1.x] Node Swapper

Created on 7 May 2025, 5 days ago

Description

Node Swapper is a simple, admin-facing tool that facilitates the otherwise rote job of replacing one node (and all of its requisite aliases and redirects) with another. The use-case is simple: an admin has a popular webpage that they want to replace with a new page without losing traffic or messing with aliases and redirects by-hand. Perhaps the new page uses a new node type, or perhaps the replacement page uses a new UI pattern. Either way, Node Swapper will cut out the guess work and make the swap a success.

The admin need only build the new page, publish it under a temporary alias, and then use Node Swapper, which exists as a UI tool located under Admin > Configuration > System > Node Swapper.

Node Swapper takes care of mapping all the existing page's redirects and aliases to the new node. Before undergoing the swap, admins are presented with a confirmation page that details what exactly Node Swapper will do. Admins also have the option to unpublish the old node and choose a custom suffix to append at the end of the old node's alias.

Adding a suffix onto the old node alias ensures that:

  1. The old node still lives at a familiar location
  2. The new node can successfully inherit the old alias

Admins are also free to set a default alias suffix and a default setting for whether to unpublish the old node at Admin > Configuration > System > Node Swapper Settings.

Similar Projects

This project leans heavily on the API from the Redirect and Alias projects and, in a sense, can be thought of as an extension of those existing modules. It doesn't really add any new features to those existing APIs, it just makes the existing ones easier to use for non-technical users, and it makes site management easier for technical users who want to save time.

That said, I don't know of an existing module that does this exact job.

Info

Git Instructions

You can git clone the node_swapper code (or download it as a tarball) from GitLab. The repo can then be installed as a module under the `modules` directory in any supported Drupal project.

📌 Task
Status

Needs review

Component

module

Created by

🇺🇸United States abenbow Asheville, North Carolina

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

Comments & Activities

Production build 0.71.5 2024