Short description

When you rename a page it would be good if moinmoin went through and updated the Wiki links of any page that linked to the old name and changed to the new name to avoid broken links.

See SearchAndReplace for (future) fix to this problem.

Problems:

In the case when you want to keep the old name, for example to prevent broken outside links, don't rename the page, but create a new page with the page content, and convert the old page to a redirect page to the new page. This will keep all existing links working. You might not want to do this if the old name should not be in the wiki or you would like to use it for another content.


I think automatically changing all pages that link to the current page is risky and not worth the complication. Automatically replacing the old page's name with a #REDIRECT to the new page, however, is a great idea. I would like there to be a check box when you rename the page "Replace old page with redirect to new page". It could be configurable at the wiki level whether this check box is selected or clear by default. I often rename a page and then manually recreate the old page with a redirect to the new page if I'm reorganizing/cleaning up/consolidating some pages. -- DavidCramer 2005-07-10 23:03:39

What if you want to use the old name for a new page? redirect is not a real solution that works for all cases.

How others solve this problem

Mediawiki simply creates a page that redirects. Additionally, this rule applies: When you rename a page, you can rename it if the target page does not exist or if it just contains one revision and a redirect. This solution is somewhat magic, but intuitive in most cases and keeps the wiki intact.

ikiwiki updates links by default when renaming pages/subpages. It works great, never had a problem with it. Seems like a fairly trivial feature to implement, unless I'm missing some technical point-- EricDrechsel 2009-11-19

Redirecting after Renaming in MoinMoin

A way to do this in MoinMoin is to modify the "PageEditor.py" by hand as follows:

I added a new Function "redirectToNewPage":

    def redirectToNewPage(self, oldpath, newpath, newpagename):
        try:
            import shutil
            shutil.copytree(newpath, oldpath)
            self.saveText("#REDIRECT " + newpagename, 0)
            return True, None
        except:
            return False, self._('Error occured in attempt to recreate old article with rediretion to new article.')

and called it in "renamePage" at the very end of the try-block, but before the return occurs of course:

            self.redirectToNewPage(oldpath, newpath, newpagename)

-- ChristianHoffmann 2007-08-14 12:25:26

Twiki does the search and gives the user an option on making the edit on each other topic individually. My success has been less than desirable at gettings those edits done automatically, even when the page isn't being edited.

UseMod does this, but I do not know how they solve the edit conflict. Ant the feature seems to be buggy.

Comment: Automatic change would be great, but all this looks like a big discussion, however:

Comment: Sometimes you rename a page because you immediatly like to add a new page with the previous used name. So it could be difficult to rename links much later. MoinMoin knows which pages were currently edited and it knows which pages do have links which needs renamed. If pages with links not edited currently there links could be renamed directly. The ones who are edited should be changed after the time limit is over for editing or probably if the user selects preview.

Comment: How about a command line util which checks if the wiki is down and then renames the pages in one batch? I understand that this solution might be less than perfect but it would solve the synchronization problem. -- A. Digulla 25.1.2005

Comment: Probably not compatible with MoinMoin internals - but how about solving this by changing the way pages are referenced internally? Instead of referencing pages by name, reference them by a unique internal ID and store the page name in an internal field inside the page or in a separate lookup table. Have MoinMoin handle the translation of IDs to names (when the page is being displayed and edited) and back (when an edited page is being stored). In this way, renaming a page only involves editing one atomic edit in one single location. If I was going to write a Wiki from scratch, I would write it like this.

Comment: We need a solution which will work with acl pages too.

Comment:We moved from Mediawiki to MoinMoin and we miss this feature really, it should work as implented in Mediawiki

Comment: In a similar vein... An even bigger problem with rename is that it does not bring all of your page's children along with it. Most of the time you would want to keep your tree together, and it's terrible to have to rename 20 some pages individually to work aroun this. Then do you really want a whole tree of redirects?? Treating pages hierarchically is much more intuitive. -- SteveDavison 2007-08-10 05:55:20

Agree with SteveDavison, i want Hierachical Renaming made possible, Thanks! :D Time

Use the Include feature

A cheap solution to page renaming is just to include the old wiki page in an Include statement within the new page, like this:

[[Include(OldPageName)]]

where OldPageName is the name of the page you want to rename.

A page with list of redirect pages

What about having a page, which contains a list of source and target "redirect". It could even allow regexp. For example :

This solution would be easy to administer. It would be possible to identify broken redirect.

Optionally, This page could be automatically populated when a page is renamed.


the mediawiki suggestion to automatically create a redirect page sounds not too bad. and it seems extensible, and maintainable, one could have to functions:

  1. rename: move page + create a redirect page
  2. fix links to redirects: maintenance function which corrects links to redirects by pointing them to the redirect target instead, leaving the displayed text intact. it might be called when a redirect is deleted, or out of a maintenace window.

-- ThurnerRupert 2009-02-21 11:27:20

For some cases it is not bad, for others, it is. If you rename some page that (for quite a while) had a good other page name and was popularly linked from other pages or the outside, a redirect is maybe what you want. OTOH, many users are not careful when creating pages and do typos in the pagename and 1 minute later rename the page to the real name (hopefully). That is the reason why you don't want to have redirect pages created automatically for rename. -- ThomasWaldmann 2009-02-21 16:48:41

: would it be possible to have an option to not create it? personally i create 5 to 10 pages with a correct page name for one with a typo. the same with renames. so the software is made for 10% of the cases. the much more important feature would be the "fix links to redirects". this would allow to reorganize wikis efficiently. our use case: the debian wiki want to change the internationalization scheme. and needs renames. but too many pages get inconsistent. -- ThurnerRupert 2009-02-21 18:07:58

--DylanMartin 2009-06-02

Dylan, how would your wiki links look like when using an ID for pages internally?


CategoryFeatureRequest

MoinMoin: FeatureRequests/RenamePageUpdatesLinkedPages (last edited 2009-11-19 14:14:51 by ThomasWaldmann)