FANDOM



Redirect code

copy redirect code

Click the "COPY REDIRECT CODE" button to copy the code for redirecting pages: #REDIRECT [[]]

NOTE: Page title should be between the square brackets.

Export this template, then import, to install it.
Use edit summary: Copied from [[w:c:templates:Template:R]] to properly attribute this template's editors.
This template is probably not already on your wiki.
Template documentation
Note: the template above may sometimes be partially or fully invisible.

View or edit this documentation. (How does this work?)

Editors can experiment with this template's sandbox and test case pages.
Description
It is a utility template that adds a section that tells an editor to copy the code for redirecting.
Dependencies

The following JS code, which should be added to MediaWiki:Common.js:

mw.hook('dev.i18n').add(function (i18n) {
    i18n.loadMessages('CopyText').done(function (i18n) {
        $('body').on('click', '.copy-to-clipboard-button', function(e){
            var text = $(this).data('text'),
            $input = $('<textarea>', { type: 'text' })
                .val($('.copy-to-clipboard-text').filter(function() {
                    return $(this).data('text') == text;
                }).first().text())
                .appendTo('body')
                .select();
            document.execCommand('Copy');
            $input.remove();
            new BannerNotification(i18n.msg('success').escape(), 'confirm').show();
        });
    });
});
importArticle({ type: 'script', article: 'u:dev:I18n-js/code.js' });
Sample output
{{R}}

gives


Redirect code

copy redirect code

Click the "COPY REDIRECT CODE" button to copy the code for redirecting pages: #REDIRECT [[]]

NOTE: Page title should be between the square brackets.


Configuration

There are also different ways to configure this template:

nonote

This configuration removes the bottom note.

{{R|nonote}}

gives


Redirect code

copy redirect code

Click the "COPY REDIRECT CODE" button to copy the code for redirecting pages: #REDIRECT [[]]


noheading

This configuration removes the top heading

{{R|noheading}}

gives


Click the "COPY REDIRECT CODE" button to copy the code for redirecting pages: #REDIRECT [[]]

copy redirect code

NOTE: Page title should be between the square brackets.


nonoteheading

This configuration removes both the bottom note and the heading.

{{R|nonoteheading}}

gives


Click the "COPY REDIRECT CODE" button to copy the code for redirecting pages: #REDIRECT [[]]

copy redirect code


simple

This configuration makes the section more simplified, leaving only the redirect code and a copy button.

{{R|simple}}

gives


Redirect code: #REDIRECT [[]] copy
Notes

Please do not attempt copying from here, as all the content will be copied at once. Go to the following pages to test them out:




Community content is available under CC-BY-SA unless otherwise noted.