Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7662765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:53:06+00:00 2026-05-31T13:53:06+00:00

My hobby is writing up stuff on a personal wiki site: http://comp-arch.net . Currently

  • 0

My hobby is writing up stuff on a personal wiki site: http://comp-arch.net.
Currently using mediawiki (although I often regret having chosen it, since I need per page access control.)

Often I create pages that define several terms or concepts on the same page. E.g. http://semipublic.comp-arch.net/wiki/Invalidate_before_writing_versus_write_through_is_the_invalidate.

Oftentimes such “A versus B” pages provide the only definitions of A and B. Or at least the only definitions that I have so far gotten around to writing.
Sometimes I will define many more that two topics on the same page.

If I create such an “A vs B” or other paging containing multiple definitions D1, D2, … DN, I would like to automatically create redirect pages, so that I can say [[A]] or [[B]] or [[D1]] .. [[DN]] in other pages.

At the moment the only way I know of to create such pages is manually. It’s hard to keep up.

Furthermore, at the time I create such a page, I would like to provide some page text – typicaly a category.


Here;s another example: variant page names. I often find that I want to create several variants of a page name, all linking to the same place. For example
[[multithreading]],
[[multithreading (MT)]],
[[MT (multithreading)]],
[[MT]]

Please don;t tell me to use piped links. That’s NOT what I want!


TWiki has plugins such as

  • TOPICCREATE automatically create topics or attach files at topic save time

More than that, I remember a twiki plugin, whose name I cannot remember or google up, that included the text of certain subpages within your current opage. You could then edit all of these pages together, and save – and the text would be extracted and distributed as needed. (By the way, if you can remember the name of tghat package, please remind me. It had certain problems, particularly wrt file locking (IIRC it only locked the top file for editing, bot the sub-topics, so you could lose stuff.))

But this last, in combination with parameterized templtes, would be almost everything I need.

Q: does mediawiki have something similar? I can’t find it.


I suppose that I can / could should wrote my own robot to perform such actions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:53:07+00:00Added an answer on May 31, 2026 at 1:53 pm

    It’s possible to do this, although I don’t know whether such extensions exist already. If you’re not averse to a bit of PHP coding, you could write your own using the ArticleSave and/or ArticleSaveComplete hooks.

    Here’s an example of an ArticleSaveComplete hook that will create redirects to the page being saved from all section titles on the page:

    $wgHooks['ArticleSaveComplete'][] = 'createRedirectsFromSectionTitles';
    function createRedirectsFromSectionTitles( &$page, &$user, $text ) {
        // do nothing for pages outside the main namespace:
        $title = $page->getTitle();
        if ( $title->getNamespace() != 0 ) return true;
    
        // extract section titles:
        // XXX: this is a very quick and dirty implementation;
        // it would be better to call the parser
        preg_match_all( '/^(=+)\s*(.*?)\s*\1\s*$/m', $text, $matches );
    
        // create a redirect for each title, unless they exist already:
        // (invalid titles and titles outside ns 0 are also skipped)
        foreach ( $matches[2] as $section ) {
            $nt = Title::newFromText( $section );
            if ( !$nt || $nt->getNamespace() != 0 || $nt->exists() ) continue;
    
            $redirPage = WikiPage::factory( $nt );
            if ( !$redirPage ) continue;  // can't happen; check anyway
    
            // initialize some variables that we can reuse:
            if ( !isset( $redirPrefix ) ) {
                $redirPrefix = MagicWord::get( 'redirect' )->getSynonym( 0 );
                $redirPrefix .= '[[' . $title->getPrefixedText() . '#';
            }
            if ( !isset( $reason ) ) {
                $reason = wfMsgForContent( 'editsummary-auto-redir-to-section' );
            }
    
            // create the page (if we can; errors are ignored):
            $redirText = $redirPrefix . $section . "]]\n";
            $flags = EDIT_NEW | EDIT_MINOR | EDIT_DEFER_UPDATES;
            $redirPage->doEdit( $redirText, $reason, $flags, false, $user );
        }
        return true;
    }
    

    Note: Much of this code is based on bits and pieces of the pagemove redirect creating code from Title.php and the double redirect fixer code, as well as the documentation for WikiPage::doEdit(). I have not actually tested this code, but I think it has at least a decent chance of working as is. Note that you’ll need to create the MediaWiki:editsummary-auto-redir-to-section page on your wiki to set a meaningful edit summary for the redirect edits.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a good sized hobby project, around 66K LOC, over at http://www.wheelmud.net Recently,
I am currently writing a KDTree for a physics engine (Hobby project). The KDTree
I'm a hobby programmer trying to build a client/server application suite, using Delphi XE.
I am doing a hobby project to scrape the content of an ASP.net website
So I've got a hobby site I'm working on. I've got items that are
I'm currently working on a hobby project, written in Java, containing about two different
I am writing a small I/O library to assist with a larger (hobby) project.
I'm currently in the process of writing a little blog / generic posting system
I have worked a bit with ASP.NET before. I was using a MS SQL
I'm writing a hobby project wherein I write to .wav files. I decided that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.